Adding spring data jpa based sql backend to Resource Service
diff --git a/pom.xml b/pom.xml
index 965c829..ad5b7fe 100755
--- a/pom.xml
+++ b/pom.xml
@@ -108,6 +108,14 @@
         <os.maven.plugin>1.5.0.Final</os.maven.plugin>
         <javax.annotation>1.3.2</javax.annotation>
         <consul.client>1.3.8</consul.client>
+        <h2>1.4.191</h2>
+        <protobuf.java>3.9.1</protobuf.java>
+        <grpc.spring.boot>3.5.0</grpc.spring.boot>
+        <spring.boot.data.jpa>1.5.13.RELEASE</spring.boot.data.jpa>
+        <dozer>5.5.1</dozer>
+        <jsch>0.1.55</jsch>
+        <sshj>0.23.0</sshj>
+
     </properties>
 
 </project>
\ No newline at end of file
diff --git a/services/pom.xml b/services/pom.xml
index 23f9bbf..e9bb24b 100644
--- a/services/pom.xml
+++ b/services/pom.xml
@@ -41,12 +41,22 @@
         <dependency>
             <groupId>com.google.protobuf</groupId>
             <artifactId>protobuf-java</artifactId>
-            <version>3.9.1</version>
+            <version>${protobuf.java}</version>
         </dependency>
         <dependency>
             <groupId>io.github.lognet</groupId>
             <artifactId>grpc-spring-boot-starter</artifactId>
-            <version>3.5.0</version>
+            <version>${grpc.spring.boot}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-jpa</artifactId>
+            <version>${spring.boot.data.jpa}</version>
+        </dependency>
+        <dependency>
+            <groupId>net.sf.dozer</groupId>
+            <artifactId>dozer</artifactId>
+            <version>${dozer}</version>
         </dependency>
     </dependencies>
 
diff --git a/services/resource-service/server/pom.xml b/services/resource-service/server/pom.xml
index f74ae82..9fe67fc 100644
--- a/services/resource-service/server/pom.xml
+++ b/services/resource-service/server/pom.xml
@@ -38,5 +38,11 @@
             <artifactId>mft-resource-service-stub</artifactId>
             <version>0.01-SNAPSHOT</version>
         </dependency>
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <version>${h2}</version>
+            <scope>runtime</scope>
+        </dependency>
     </dependencies>
 </project>
\ No newline at end of file
diff --git a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/AppConfig.java b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/AppConfig.java
new file mode 100644
index 0000000..a21a9d3
--- /dev/null
+++ b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/AppConfig.java
@@ -0,0 +1,31 @@
+/*
+ * 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.mft.resource.server;
+
+import org.apache.airavata.mft.resource.server.backend.ResourceBackend;
+import org.apache.airavata.mft.resource.server.backend.sql.SQLResourceBackend;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class AppConfig {
+    @Bean
+    public ResourceBackend resourceBackend() {
+        return new SQLResourceBackend();
+    }
+}
diff --git a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/ResourceServiceApplication.java b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/ResourceServiceApplication.java
index ba7711c..40dba21 100644
--- a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/ResourceServiceApplication.java
+++ b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/ResourceServiceApplication.java
@@ -19,8 +19,10 @@
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
 
 @SpringBootApplication
+@ComponentScan(basePackages = {"org.apache.airavata"})
 public class ResourceServiceApplication {
     public static void main(String args[]) {
         SpringApplication.run(ResourceServiceApplication.class, args);
diff --git a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/ResourceBackend.java b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/ResourceBackend.java
new file mode 100644
index 0000000..02c5d28
--- /dev/null
+++ b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/ResourceBackend.java
@@ -0,0 +1,39 @@
+/*
+ * 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.mft.resource.server.backend;
+
+import org.apache.airavata.mft.resource.service.*;
+
+import java.util.Optional;
+
+public interface ResourceBackend {
+    public Optional<SCPStorage> getSCPStorage(SCPStorageGetRequest request);
+    public SCPStorage createSCPStorage(SCPStorageCreateRequest request);
+    public boolean updateSCPStorage(SCPStorageUpdateRequest request);
+    public boolean deleteSCPStorage(SCPStorageDeleteRequest request);
+
+    public Optional<SCPResource> getSCPResource(SCPResourceGetRequest request);
+    public SCPResource createSCPResource(SCPResourceCreateRequest request);
+    public boolean updateSCPResource(SCPResourceUpdateRequest request);
+    public boolean deleteSCPResource(SCPResourceDeleteRequest request);
+
+    public Optional<LocalResource> getLocalResource(LocalResourceGetRequest request);
+    public LocalResource createLocalResource(LocalResourceCreateRequest request);
+    public boolean updateLocalResource(LocalResourceUpdateRequest request);
+    public boolean deleteLocalResource(LocalResourceDeleteRequest request);
+}
diff --git a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/SQLResourceBackend.java b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/SQLResourceBackend.java
new file mode 100644
index 0000000..220f518
--- /dev/null
+++ b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/SQLResourceBackend.java
@@ -0,0 +1,117 @@
+/*
+ * 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.mft.resource.server.backend.sql;
+
+import org.apache.airavata.mft.resource.server.backend.ResourceBackend;
+import org.apache.airavata.mft.resource.server.backend.sql.entity.LocalResourceEntity;
+import org.apache.airavata.mft.resource.server.backend.sql.entity.SCPResourceEntity;
+import org.apache.airavata.mft.resource.server.backend.sql.entity.SCPStorageEntity;
+import org.apache.airavata.mft.resource.server.backend.sql.repository.LocalResourceRepository;
+import org.apache.airavata.mft.resource.server.backend.sql.repository.SCPResourceRepository;
+import org.apache.airavata.mft.resource.server.backend.sql.repository.SCPStorageRepository;
+import org.apache.airavata.mft.resource.service.*;
+import org.dozer.DozerBeanMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Optional;
+
+public class SQLResourceBackend implements ResourceBackend {
+
+    @Autowired
+    private SCPStorageRepository scpStorageRepository;
+
+    @Autowired
+    private SCPResourceRepository scpResourceRepository;
+
+    @Autowired
+    private LocalResourceRepository localResourceRepository;
+
+    private DozerBeanMapper mapper = new DozerBeanMapper();
+
+    @Override
+    public Optional<SCPStorage> getSCPStorage(SCPStorageGetRequest request) {
+        Optional<SCPStorageEntity> storageEty = scpStorageRepository.findByStorageId(request.getStorageId());
+        return storageEty.map(scpStorageEntity -> mapper.map(scpStorageEntity, SCPStorage.class));
+    }
+
+    @Override
+    public SCPStorage createSCPStorage(SCPStorageCreateRequest request) {
+        SCPStorageEntity savedEntity = scpStorageRepository.save(mapper.map(request, SCPStorageEntity.class));
+        return mapper.map(savedEntity, SCPStorage.class);
+    }
+
+    @Override
+    public boolean updateSCPStorage(SCPStorageUpdateRequest request) {
+        SCPStorageEntity updatedEntity = scpStorageRepository.save(mapper.map(request, SCPStorageEntity.class));
+        return true;
+    }
+
+    @Override
+    public boolean deleteSCPStorage(SCPStorageDeleteRequest request) {
+        scpStorageRepository.delete(request.getStorageId());
+        return true;
+    }
+
+    @Override
+    public Optional<SCPResource> getSCPResource(SCPResourceGetRequest request) {
+        Optional<SCPResourceEntity> resourceEntity = scpResourceRepository.findByResourceId(request.getResourceId());
+        return resourceEntity.map(scpResourceEntity -> mapper.map(scpResourceEntity, SCPResource.class));
+    }
+
+    @Override
+    public SCPResource createSCPResource(SCPResourceCreateRequest request) {
+        SCPResourceEntity savedEntity = scpResourceRepository.save(mapper.map(request, SCPResourceEntity.class));
+        return mapper.map(savedEntity, SCPResource.class);
+    }
+
+    @Override
+    public boolean updateSCPResource(SCPResourceUpdateRequest request) {
+        SCPResourceEntity updatedEntity = scpResourceRepository.save(mapper.map(request, SCPResourceEntity.class));
+        return true;
+    }
+
+    @Override
+    public boolean deleteSCPResource(SCPResourceDeleteRequest request) {
+        scpResourceRepository.delete(request.getResourceId());
+        return true;
+    }
+
+    @Override
+    public Optional<LocalResource> getLocalResource(LocalResourceGetRequest request) {
+        Optional<LocalResourceEntity> resourceEntity = localResourceRepository.findByResourceId(request.getResourceId());
+        return resourceEntity.map(scpResourceEntity -> mapper.map(scpResourceEntity, LocalResource.class));
+    }
+
+    @Override
+    public LocalResource createLocalResource(LocalResourceCreateRequest request) {
+        LocalResourceEntity savedEntity = localResourceRepository.save(mapper.map(request, LocalResourceEntity.class));
+        return mapper.map(savedEntity, LocalResource.class);
+    }
+
+    @Override
+    public boolean updateLocalResource(LocalResourceUpdateRequest request) {
+        LocalResourceEntity updatedEntity = localResourceRepository.save(mapper.map(request, LocalResourceEntity.class));
+        return true;
+    }
+
+    @Override
+    public boolean deleteLocalResource(LocalResourceDeleteRequest request) {
+        localResourceRepository.delete(request.getResourceId());
+        return true;
+    }
+}
diff --git a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/LocalResourceEntity.java b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/LocalResourceEntity.java
new file mode 100644
index 0000000..aad2324
--- /dev/null
+++ b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/LocalResourceEntity.java
@@ -0,0 +1,49 @@
+/*
+ * 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.mft.resource.server.backend.sql.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity
+public class LocalResourceEntity {
+
+    @Id
+    @Column(name = "LOCAL_RESOURCE_ID")
+    private String resourceId;
+
+    @Column(name = "RESOURCE_PATH")
+    private String resourcePath;
+
+    public String getResourceId() {
+        return resourceId;
+    }
+
+    public void setResourceId(String resourceId) {
+        this.resourceId = resourceId;
+    }
+
+    public String getResourcePath() {
+        return resourcePath;
+    }
+
+    public void setResourcePath(String resourcePath) {
+        this.resourcePath = resourcePath;
+    }
+}
diff --git a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/SCPResourceEntity.java b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/SCPResourceEntity.java
new file mode 100644
index 0000000..90ef07b
--- /dev/null
+++ b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/SCPResourceEntity.java
@@ -0,0 +1,69 @@
+/*
+ * 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.mft.resource.server.backend.sql.entity;
+
+import javax.persistence.*;
+
+@Entity
+public class SCPResourceEntity {
+
+    @Id
+    @Column(name = "SCP_RESOURCE_ID")
+    private String resourceId;
+
+    @ManyToOne(fetch = FetchType.EAGER)
+    @JoinColumn(name = "SCP_STORAGE_ID", referencedColumnName = "SCP_STORAGE_ID", nullable = false, updatable = false)
+    private SCPStorageEntity scpStorage;
+
+    @Column(name = "SCP_STORAGE_ID", insertable = false, updatable = false)
+    private String scpStorageId;
+
+    @Column(name = "RESOURCE_PATH")
+    private String resourcePath;
+
+    public String getResourceId() {
+        return resourceId;
+    }
+
+    public void setResourceId(String resourceId) {
+        this.resourceId = resourceId;
+    }
+
+    public SCPStorageEntity getScpStorage() {
+        return scpStorage;
+    }
+
+    public void setScpStorage(SCPStorageEntity scpStorage) {
+        this.scpStorage = scpStorage;
+    }
+
+    public String getResourcePath() {
+        return resourcePath;
+    }
+
+    public void setResourcePath(String resourcePath) {
+        this.resourcePath = resourcePath;
+    }
+
+    public String getScpStorageId() {
+        return scpStorageId;
+    }
+
+    public void setScpStorageId(String scpStorageId) {
+        this.scpStorageId = scpStorageId;
+    }
+}
diff --git a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/SCPStorageEntity.java b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/SCPStorageEntity.java
new file mode 100644
index 0000000..94d3786
--- /dev/null
+++ b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/SCPStorageEntity.java
@@ -0,0 +1,59 @@
+/*
+ * 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.mft.resource.server.backend.sql.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity
+public class SCPStorageEntity {
+
+    @Id
+    @Column(name = "SCP_STORAGE_ID")
+    private String storageId;
+
+    @Column(name = "HOST")
+    private String host;
+
+    @Column(name = "PORT")
+    private int port;
+
+    public String getStorageId() {
+        return storageId;
+    }
+
+    public void setStorageId(String storageId) {
+        this.storageId = storageId;
+    }
+
+    public String getHost() {
+        return host;
+    }
+
+    public void setHost(String host) {
+        this.host = host;
+    }
+
+    public int getPort() {
+        return port;
+    }
+
+    public void setPort(int port) {
+        this.port = port;
+    }
+}
diff --git a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/LocalResourceRepository.java b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/LocalResourceRepository.java
new file mode 100644
index 0000000..cd062fc
--- /dev/null
+++ b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/LocalResourceRepository.java
@@ -0,0 +1,27 @@
+/*
+ * 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.mft.resource.server.backend.sql.repository;
+
+import org.apache.airavata.mft.resource.server.backend.sql.entity.LocalResourceEntity;
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.Optional;
+
+public interface LocalResourceRepository extends CrudRepository<LocalResourceEntity, String> {
+    Optional<LocalResourceEntity> findByResourceId(String resourceId);
+}
diff --git a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/SCPResourceRepository.java b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/SCPResourceRepository.java
new file mode 100644
index 0000000..5f3a0bc
--- /dev/null
+++ b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/SCPResourceRepository.java
@@ -0,0 +1,27 @@
+/*
+ * 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.mft.resource.server.backend.sql.repository;
+
+import org.apache.airavata.mft.resource.server.backend.sql.entity.SCPResourceEntity;
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.Optional;
+
+public interface SCPResourceRepository extends CrudRepository<SCPResourceEntity, String> {
+    Optional<SCPResourceEntity> findByResourceId(String resourceId);
+}
diff --git a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/SCPStorageRepository.java b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/SCPStorageRepository.java
new file mode 100644
index 0000000..3772e15
--- /dev/null
+++ b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/SCPStorageRepository.java
@@ -0,0 +1,27 @@
+/*
+ * 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.mft.resource.server.backend.sql.repository;
+
+import org.apache.airavata.mft.resource.server.backend.sql.entity.SCPStorageEntity;
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.Optional;
+
+public interface SCPStorageRepository extends CrudRepository<SCPStorageEntity, String> {
+    Optional<SCPStorageEntity> findByStorageId(String storageId);
+}
diff --git a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/handler/ResourceServiceHandler.java b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/handler/ResourceServiceHandler.java
index f707f3e..c4baa84 100644
--- a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/handler/ResourceServiceHandler.java
+++ b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/handler/ResourceServiceHandler.java
@@ -14,81 +14,130 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+/*
+ * 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.mft.resource.server.handler;
 
 import com.google.protobuf.Empty;
 import io.grpc.stub.StreamObserver;
+import org.apache.airavata.mft.resource.server.backend.ResourceBackend;
 import org.apache.airavata.mft.resource.service.*;
 import org.lognet.springboot.grpc.GRpcService;
+import org.springframework.beans.factory.annotation.Autowired;
 
 @GRpcService
 public class ResourceServiceHandler extends ResourceServiceGrpc.ResourceServiceImplBase {
 
+    @Autowired
+    private ResourceBackend backend;
+
     @Override
     public void getSCPStorage(SCPStorageGetRequest request, StreamObserver<SCPStorage> responseObserver) {
-        super.getSCPStorage(request, responseObserver);
+        this.backend.getSCPStorage(request).ifPresentOrElse(storage -> {
+            responseObserver.onNext(storage);
+            responseObserver.onCompleted();
+        }, () -> {
+            responseObserver.onError(new Exception("No SCP Storage with id " + request.getStorageId()));
+        });
     }
 
     @Override
     public void createSCPStorage(SCPStorageCreateRequest request, StreamObserver<SCPStorage> responseObserver) {
-        super.createSCPStorage(request, responseObserver);
+        responseObserver.onNext(this.backend.createSCPStorage(request));
+        responseObserver.onCompleted();
     }
 
     @Override
     public void updateSCPStorage(SCPStorageUpdateRequest request, StreamObserver<Empty> responseObserver) {
-        super.updateSCPStorage(request, responseObserver);
+        this.backend.updateSCPStorage(request);
+        responseObserver.onCompleted();
     }
 
     @Override
     public void deleteSCPStorage(SCPStorageDeleteRequest request, StreamObserver<Empty> responseObserver) {
-        super.deleteSCPStorage(request, responseObserver);
+        boolean res = this.backend.deleteSCPStorage(request);
+        if (res) {
+            responseObserver.onCompleted();
+        } else {
+            responseObserver.onError(new Exception("Failed to delete SCP Storage with id " + request.getStorageId()));
+        }
     }
 
     @Override
     public void getSCPResource(SCPResourceGetRequest request, StreamObserver<SCPResource> responseObserver) {
-        SCPResource.Builder resourceBuilder = SCPResource.newBuilder().setResourceId("001")
-                .setScpStorage(SCPStorage.newBuilder()
-                        .setHost("localhost")
-                        .setPort(22).build());
-        responseObserver.onNext(resourceBuilder.build());
-        responseObserver.onCompleted();
-
-
+        this.backend.getSCPResource(request).ifPresentOrElse(resource -> {
+            responseObserver.onNext(resource);
+            responseObserver.onCompleted();
+        }, () -> {
+            responseObserver.onError(new Exception("No SCP Resource with id " + request.getResourceId()));
+        });
     }
 
     @Override
     public void createSCPResource(SCPResourceCreateRequest request, StreamObserver<SCPResource> responseObserver) {
-        super.createSCPResource(request, responseObserver);
+        responseObserver.onNext(this.backend.createSCPResource(request));
+        responseObserver.onCompleted();
     }
 
     @Override
     public void updateSCPResource(SCPResourceUpdateRequest request, StreamObserver<Empty> responseObserver) {
-        super.updateSCPResource(request, responseObserver);
+        this.backend.updateSCPResource(request);
+        responseObserver.onCompleted();
     }
 
     @Override
     public void deleteSCPResource(SCPResourceDeleteRequest request, StreamObserver<Empty> responseObserver) {
-        super.deleteSCPResource(request, responseObserver);
+        boolean res = this.backend.deleteSCPResource(request);
+        if (res) {
+            responseObserver.onCompleted();
+        } else {
+            responseObserver.onError(new Exception("Failed to delete SCP Resource with id " + request.getResourceId()));
+        }
     }
 
     @Override
     public void getLocalResource(LocalResourceGetRequest request, StreamObserver<LocalResource> responseObserver) {
-        super.getLocalResource(request, responseObserver);
+        this.backend.getLocalResource(request).ifPresentOrElse(resource -> {
+            responseObserver.onNext(resource);
+            responseObserver.onCompleted();
+        }, () -> {
+            responseObserver.onError(new Exception("No Local Resource with id " + request.getResourceId()));
+        });
     }
 
     @Override
     public void createLocalResource(LocalResourceCreateRequest request, StreamObserver<LocalResource> responseObserver) {
-        super.createLocalResource(request, responseObserver);
+        responseObserver.onNext(this.backend.createLocalResource(request));
+        responseObserver.onCompleted();
     }
 
     @Override
     public void updateLocalResource(LocalResourceUpdateRequest request, StreamObserver<Empty> responseObserver) {
-        super.updateLocalResource(request, responseObserver);
+        this.backend.updateLocalResource(request);
+        responseObserver.onCompleted();
     }
 
     @Override
     public void deleteLocalResource(LocalResourceDeleteRequest request, StreamObserver<Empty> responseObserver) {
-        super.deleteLocalResource(request, responseObserver);
-    }
+        boolean res = this.backend.deleteLocalResource(request);
+        if (res) {
+            responseObserver.onCompleted();
+        } else {
+            responseObserver.onError(new Exception("Failed to delete Local Resource with id " + request.getResourceId()));
+        }    }
 }
diff --git a/transport/scp-transport/pom.xml b/transport/scp-transport/pom.xml
index 40ffa56..3d6d6c9 100755
--- a/transport/scp-transport/pom.xml
+++ b/transport/scp-transport/pom.xml
@@ -36,12 +36,12 @@
         <dependency>
             <groupId>com.jcraft</groupId>
             <artifactId>jsch</artifactId>
-            <version>0.1.55</version>
+            <version>${jsch}</version>
         </dependency>
         <dependency>
             <groupId>com.hierynomus</groupId>
             <artifactId>sshj</artifactId>
-            <version>0.23.0</version>
+            <version>${sshj}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.airavata</groupId>