Repository: airavata Updated Branches: refs/heads/develop 6d320248f -> a963d3f0c
http://git-wip-us.apache.org/repos/asf/airavata/blob/a963d3f0/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataProductMetaData_PK.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataProductMetaData_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataProductMetaData_PK.java new file mode 100644 index 0000000..2242d3b --- /dev/null +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataProductMetaData_PK.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.registry.core.data.catalog.model; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.Serializable; + +public class DataProductMetaData_PK implements Serializable { + private final static Logger logger = LoggerFactory.getLogger(DataProductMetaData_PK.class); + + private String productId; + private String key; + + public String getProductId() { + return productId; + } + + public void setProductId(String productId) { + this.productId = productId; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + @Override + public boolean equals(Object o) { + return false; + } + + @Override + public int hashCode() { + return 1; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/a963d3f0/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataReplicaLocation.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataReplicaLocation.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataReplicaLocation.java index ea58824..fa38815 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataReplicaLocation.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataReplicaLocation.java @@ -32,7 +32,7 @@ import java.util.Collection; public class DataReplicaLocation { private final static Logger logger = LoggerFactory.getLogger(DataReplicaLocation.class); private String replicaId; - private String resourceId; + private String productId; private String replicaName; private String replicaDescription; private String storageResourceId; @@ -43,7 +43,7 @@ public class DataReplicaLocation { private Timestamp lastModifiedTime; private Timestamp validUntilTime; - private DataResource dataResource; + private DataProduct dataProduct; private Collection<DataReplicaMetaData> dataReplicaMetaData; @Id @@ -56,13 +56,13 @@ public class DataReplicaLocation { this.replicaId = replicaId; } - @Column(name = "RESOURCE_ID") - public String getResourceId() { - return resourceId; + @Column(name = "PRODUCT_ID") + public String getProductId() { + return productId; } - public void setResourceId(String resourceId) { - this.resourceId = resourceId; + public void setProductId(String productId) { + this.productId = productId; } @@ -149,13 +149,13 @@ public class DataReplicaLocation { } @ManyToOne - @JoinColumn(name = "RESOURCE_ID", referencedColumnName = "RESOURCE_ID") - public DataResource getDataResource() { - return dataResource; + @JoinColumn(name = "PRODUCT_ID", referencedColumnName = "PRODUCT_ID") + public DataProduct getDataProduct() { + return dataProduct; } - public void setDataResource(DataResource dataResource) { - this.dataResource = dataResource; + public void setDataProduct(DataProduct dataProduct) { + this.dataProduct = dataProduct; } @OneToMany(mappedBy = "dataReplicaLocation", cascade = {CascadeType.ALL}) http://git-wip-us.apache.org/repos/asf/airavata/blob/a963d3f0/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataResource.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataResource.java deleted file mode 100644 index c570212..0000000 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataResource.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * - * 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.registry.core.data.catalog.model; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.persistence.*; -import java.sql.Timestamp; -import java.util.Collection; - -@Entity -@Table(name = "DATA_RESOURCE") -public class DataResource { - private final static Logger logger = LoggerFactory.getLogger(DataResource.class); - private String resourceId; - private String gatewayId; - private String resourceName; - private String resourceDescription; - private String dataResourceType; - private String ownerName; - private String parentResourceId; - private int resourceSize; - private Timestamp creationTime; - private Timestamp lastModifiedTime; - - private DataResource parentResource; - private Collection<DataReplicaLocation> dataReplicaLocations; - private Collection<DataResourceMetaData> dataResourceMetaData; - private Collection<DataResource> childDataResources; - - @Id - @Column(name = "RESOURCE_ID") - public String getResourceId() { - return resourceId; - } - - public void setResourceId(String resourceId) { - this.resourceId = resourceId; - } - - @Column(name = "GATEWAY_ID") - public String getGatewayId() { - return gatewayId; - } - - public void setGatewayId(String gatewayId) { - this.gatewayId = gatewayId; - } - - @Column(name = "RESOURCE_NAME") - public String getResourceName() { - return resourceName; - } - - public void setResourceName(String resourceName) { - this.resourceName = resourceName; - } - - @Column(name = "RESOURCE_DESCRIPTION") - public String getResourceDescription() { - return resourceDescription; - } - - public void setResourceDescription(String resourceDescription) { - this.resourceDescription = resourceDescription; - } - - @Column(name = "OWNER_NAME") - public String getOwnerName() { - return ownerName; - } - - public void setOwnerName(String ownerName) { - this.ownerName = ownerName; - } - - @Column(name = "PARENT_RESOURCE_ID") - public String getParentResourceId() { - return parentResourceId; - } - - public void setParentResourceId(String parentResourceId) { - this.parentResourceId = parentResourceId; - } - - @Column(name = "RESOURCE_TYPE") - public String getDataResourceType() { - return dataResourceType; - } - - public void setDataResourceType(String dataResourceType) { - this.dataResourceType = dataResourceType; - } - - @Column(name = "RESOURCE_SIZE") - public int getResourceSize() { - return resourceSize; - } - - public void setResourceSize(int resourceSize) { - this.resourceSize = resourceSize; - } - - @Column(name = "CREATION_TIME") - public Timestamp getCreationTime() { - return creationTime; - } - - public void setCreationTime(Timestamp creationTime) { - this.creationTime = creationTime; - } - - @Column(name = "LAST_MODIFIED_TIME") - public Timestamp getLastModifiedTime() { - return lastModifiedTime; - } - - public void setLastModifiedTime(Timestamp lastModifiedTime) { - this.lastModifiedTime = lastModifiedTime; - } - - @OneToMany(mappedBy = "dataResource", cascade = {CascadeType.ALL}) - public Collection<DataReplicaLocation> getDataReplicaLocations() { - return dataReplicaLocations; - } - - public void setDataReplicaLocations(Collection<DataReplicaLocation> dataReplicaLocations) { - this.dataReplicaLocations = dataReplicaLocations; - } - - @OneToMany(mappedBy = "dataResource", cascade = {CascadeType.ALL}) - public Collection<DataResourceMetaData> getDataResourceMetaData() { - return dataResourceMetaData; - } - - public void setDataResourceMetaData(Collection<DataResourceMetaData> dataResourceMetaData) { - this.dataResourceMetaData = dataResourceMetaData; - } - - @ManyToOne - @JoinColumn(name = "PARENT_RESOURCE_ID", referencedColumnName = "RESOURCE_ID") - public DataResource getParentResource() { - return parentResource; - } - - public void setParentResource(DataResource parentResource) { - this.parentResource = parentResource; - } - - @OneToMany(mappedBy = "parentResource", cascade = {CascadeType.ALL}) - public Collection<DataResource> getChildDataResources() { - return childDataResources; - } - - public void setChildDataResources(Collection<DataResource> childDataResources) { - this.childDataResources = childDataResources; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/a963d3f0/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataResourceMetaData.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataResourceMetaData.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataResourceMetaData.java deleted file mode 100644 index d703bac..0000000 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataResourceMetaData.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * - * 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.registry.core.data.catalog.model; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.persistence.*; - -@Entity -@Table(name = "DATA_RESOURCE_METADATA") -@IdClass(DataResourceMetaData_PK.class) -public class DataResourceMetaData { - private final static Logger logger = LoggerFactory.getLogger(DataResourceMetaData.class); - private String resourceId; - private String key; - private String value; - - private DataResource dataResource; - - @Id - @Column(name = "RESOURCE_ID") - public String getResourceId() { - return resourceId; - } - - public void setResourceId(String resourceId) { - this.resourceId = resourceId; - } - - @Id - @Column(name = "METADATA_KEY") - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - @Column(name = "METADATA_VALUE") - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - @ManyToOne - @JoinColumn(name = "RESOURCE_ID", referencedColumnName = "RESOURCE_ID") - public DataResource getDataResource() { - return dataResource; - } - - public void setDataResource(DataResource dataResource) { - this.dataResource = dataResource; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/a963d3f0/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataResourceMetaData_PK.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataResourceMetaData_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataResourceMetaData_PK.java deleted file mode 100644 index 60545fe..0000000 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/model/DataResourceMetaData_PK.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * - * 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.registry.core.data.catalog.model; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.Serializable; - -public class DataResourceMetaData_PK implements Serializable { - private final static Logger logger = LoggerFactory.getLogger(DataResourceMetaData_PK.class); - - private String resourceId; - private String key; - - public String getResourceId() { - return resourceId; - } - - public void setResourceId(String resourceId) { - this.resourceId = resourceId; - } - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - @Override - public boolean equals(Object o) { - return false; - } - - @Override - public int hashCode() { - return 1; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/a963d3f0/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/utils/DataCatalogConstants.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/utils/DataCatalogConstants.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/utils/DataCatalogConstants.java index c9e18f6..f0956e3 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/utils/DataCatalogConstants.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/utils/DataCatalogConstants.java @@ -22,11 +22,11 @@ package org.apache.airavata.registry.core.data.catalog.utils; public class DataCatalogConstants { // table names - public static final String DATA_RESOURCE = "DataResource"; + public static final String DATA_RESOURCE = "DataProduct"; public static final String DATA_REPLICA_LOCATION = "DataReplicaLocation"; public static final String CONFIGURATION = "Configuration"; - // DataResource Table + // DataProduct Table public final class DataResourceConstants { public static final String RESOURCE_ID = "resourceId"; public static final String RESOURCE_NAME = "resourceName"; http://git-wip-us.apache.org/repos/asf/airavata/blob/a963d3f0/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/utils/ThriftDataModelConversion.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/utils/ThriftDataModelConversion.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/utils/ThriftDataModelConversion.java index 7658631..5f256f4 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/utils/ThriftDataModelConversion.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/utils/ThriftDataModelConversion.java @@ -21,11 +21,11 @@ package org.apache.airavata.registry.core.data.catalog.utils; -import org.apache.airavata.model.data.resource.*; +import org.apache.airavata.model.data.product.*; +import org.apache.airavata.registry.core.data.catalog.model.DataProduct; +import org.apache.airavata.registry.core.data.catalog.model.DataProductMetaData; import org.apache.airavata.registry.core.data.catalog.model.DataReplicaLocation; import org.apache.airavata.registry.core.data.catalog.model.DataReplicaMetaData; -import org.apache.airavata.registry.core.data.catalog.model.DataResource; -import org.apache.airavata.registry.core.data.catalog.model.DataResourceMetaData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,115 +39,115 @@ public class ThriftDataModelConversion { private final static Logger logger = LoggerFactory.getLogger(ThriftDataModelConversion.class); - public static DataResourceModel getDataResourceModel(DataResource dataResource){ - if (dataResource != null) { - DataResourceModel dataResourceModel = new DataResourceModel(); - dataResourceModel.setResourceId(dataResource.getResourceId()); - dataResourceModel.setGatewayId(dataResource.getGatewayId()); - dataResourceModel.setParentResourceId(dataResource.getParentResourceId()); - dataResourceModel.setResourceName(dataResource.getResourceName()); - if(dataResource.getDataResourceType() != null) - dataResourceModel.setDataResourceType(DataResourceType.valueOf(dataResource.getDataResourceType())); + public static DataProductModel getDataProductModel(DataProduct dataProduct){ + if (dataProduct != null) { + DataProductModel dataProductModel = new DataProductModel(); + dataProductModel.setProductId(dataProduct.getResourceId()); + dataProductModel.setGatewayId(dataProduct.getGatewayId()); + dataProductModel.setParentProductId(dataProduct.getParentProductId()); + dataProductModel.setProductName(dataProduct.getProductName()); + if(dataProduct.getDataProductType() != null) + dataProductModel.setDataProductType(DataProductType.valueOf(dataProduct.getDataProductType())); else - dataResourceModel.setDataResourceType(DataResourceType.FILE); - dataResourceModel.setResourceDescription(dataResource.getResourceDescription()); - dataResourceModel.setOwnerName(dataResource.getOwnerName()); - dataResourceModel.setResourceSize(dataResource.getResourceSize()); - if(dataResource.getCreationTime() != null) - dataResourceModel.setCreationTime(dataResource.getCreationTime().getTime()); - if(dataResource.getLastModifiedTime() != null) - dataResourceModel.setLastModifiedTime(dataResource.getLastModifiedTime().getTime()); - dataResourceModel.setResourceMetadata(getResourceMetaData(dataResource.getDataResourceMetaData())); - if(dataResource.getDataReplicaLocations() != null){ + dataProductModel.setDataProductType(DataProductType.FILE); + dataProductModel.setProductDescription(dataProduct.getProductDescription()); + dataProductModel.setOwnerName(dataProduct.getOwnerName()); + dataProductModel.setProductSize(dataProduct.getProductSize()); + if(dataProduct.getCreationTime() != null) + dataProductModel.setCreationTime(dataProduct.getCreationTime().getTime()); + if(dataProduct.getLastModifiedTime() != null) + dataProductModel.setLastModifiedTime(dataProduct.getLastModifiedTime().getTime()); + dataProductModel.setProductMetadata(getResourceMetaData(dataProduct.getDataProductMetaData())); + if(dataProduct.getDataReplicaLocations() != null){ ArrayList<DataReplicaLocationModel> dataReplicaLocationModels = new ArrayList<>(); - dataResource.getDataReplicaLocations().stream().forEach(r->dataReplicaLocationModels + dataProduct.getDataReplicaLocations().stream().forEach(r->dataReplicaLocationModels .add(getDataReplicaLocationModel(r))); - dataResourceModel.setReplicaLocations(dataReplicaLocationModels); + dataProductModel.setReplicaLocations(dataReplicaLocationModels); } - if(dataResourceModel.getDataResourceType().equals(DataResourceType.COLLECTION) && dataResource.getChildDataResources() != null){ - ArrayList<DataResourceModel> childDataResources = new ArrayList<>(); - dataResource.getChildDataResources().stream().forEach(r->childDataResources.add(getDataResourceModel(r))); - dataResourceModel.setChildResources(childDataResources); + if(dataProductModel.getDataProductType().equals(DataProductType.COLLECTION) && dataProduct.getChildDataProducts() != null){ + ArrayList<DataProductModel> childDataProducts = new ArrayList<>(); + dataProduct.getChildDataProducts().stream().forEach(r->childDataProducts.add(getDataProductModel(r))); + dataProductModel.setChildProducts(childDataProducts); } - return dataResourceModel; + return dataProductModel; } return null; } - public static DataResource getDataResource(DataResourceModel dataResourceModel){ - if(dataResourceModel != null){ - DataResource dataResource = new DataResource(); - return getUpdatedDataResource(dataResourceModel, dataResource); + public static DataProduct getDataProduct(DataProductModel dataProductModel){ + if(dataProductModel != null){ + DataProduct dataProduct = new DataProduct(); + return getUpdatedDataProduct(dataProductModel, dataProduct); } return null; } - public static DataResource getUpdatedDataResource(DataResourceModel dataResourceModel, DataResource dataResource){ - dataResource.setResourceId(dataResourceModel.getResourceId()); - dataResource.setGatewayId(dataResourceModel.getGatewayId()); - dataResource.setResourceName(dataResourceModel.getResourceName()); - dataResource.setParentResourceId(dataResourceModel.getParentResourceId()); - if(dataResourceModel.getDataResourceType() != null) - dataResource.setDataResourceType(dataResourceModel.getDataResourceType().toString()); + public static DataProduct getUpdatedDataProduct(DataProductModel dataProductModel, DataProduct dataProduct){ + dataProduct.setResourceId(dataProductModel.getProductId()); + dataProduct.setGatewayId(dataProductModel.getGatewayId()); + dataProduct.setProductName(dataProductModel.getProductName()); + dataProduct.setParentProductId(dataProductModel.getParentProductId()); + if(dataProductModel.getDataProductType() != null) + dataProduct.setDataProductType(dataProductModel.getDataProductType().toString()); else - dataResource.setDataResourceType(DataResourceType.FILE.toString()); - dataResource.setResourceDescription(dataResourceModel.getResourceDescription()); - dataResource.setOwnerName(dataResourceModel.getOwnerName()); - dataResource.setResourceSize(dataResourceModel.getResourceSize()); - if(dataResourceModel.getCreationTime() > 0) - dataResource.setCreationTime(new Timestamp(dataResourceModel.getCreationTime())); - if(dataResourceModel.getLastModifiedTime() > 0) - dataResource.setLastModifiedTime(new Timestamp(dataResourceModel.getLastModifiedTime())); - ArrayList<DataResourceMetaData> dataResourceMetaData = new ArrayList<>(); - if(dataResourceModel.getResourceMetadata() != null) { - dataResourceModel.getResourceMetadata().keySet().stream().forEach(k -> { - String v = dataResourceModel.getResourceMetadata().get(k); - DataResourceMetaData temp = new DataResourceMetaData(); - temp.setResourceId(dataResource.getResourceId()); + dataProduct.setDataProductType(DataProductType.FILE.toString()); + dataProduct.setProductDescription(dataProductModel.getProductDescription()); + dataProduct.setOwnerName(dataProductModel.getOwnerName()); + dataProduct.setProductSize(dataProductModel.getProductSize()); + if(dataProductModel.getCreationTime() > 0) + dataProduct.setCreationTime(new Timestamp(dataProductModel.getCreationTime())); + if(dataProductModel.getLastModifiedTime() > 0) + dataProduct.setLastModifiedTime(new Timestamp(dataProductModel.getLastModifiedTime())); + ArrayList<DataProductMetaData> dataProductMetaData = new ArrayList<>(); + if(dataProductModel.getProductMetadata() != null) { + dataProductModel.getProductMetadata().keySet().stream().forEach(k -> { + String v = dataProductModel.getProductMetadata().get(k); + DataProductMetaData temp = new DataProductMetaData(); + temp.setProductId(dataProduct.getResourceId()); temp.setKey(k); temp.setValue(v); - dataResourceMetaData.add(temp); + dataProductMetaData.add(temp); }); - dataResource.setDataResourceMetaData(dataResourceMetaData); + dataProduct.setDataProductMetaData(dataProductMetaData); } - if(dataResourceModel.getReplicaLocations() != null){ + if(dataProductModel.getReplicaLocations() != null){ ArrayList<DataReplicaLocation> dataReplicaLocations = new ArrayList<>(); - dataResourceModel.getReplicaLocations().stream().forEach(r->{ + dataProductModel.getReplicaLocations().stream().forEach(r->{ DataReplicaLocation dataReplicaLocationModel = getDataReplicaLocation(r); - dataReplicaLocationModel.setResourceId(dataResourceModel.getResourceId()); + dataReplicaLocationModel.setProductId(dataProductModel.getProductId()); dataReplicaLocations.add(dataReplicaLocationModel); }); - dataResource.setDataReplicaLocations(dataReplicaLocations); + dataProduct.setDataReplicaLocations(dataReplicaLocations); } - if(dataResourceModel.getDataResourceType() == DataResourceType.COLLECTION && dataResourceModel.getChildResources() != null){ - ArrayList<DataResource> childDataResources = new ArrayList<>(); - dataResourceModel.getChildResources().stream().forEach(r->childDataResources.add(getDataResource(r))); - dataResource.setChildDataResources(childDataResources); + if(dataProductModel.getDataProductType() == DataProductType.COLLECTION && dataProductModel.getChildProducts() != null){ + ArrayList<DataProduct> childDataProducts = new ArrayList<>(); + dataProductModel.getChildProducts().stream().forEach(r->childDataProducts.add(getDataProduct(r))); + dataProduct.setChildDataProducts(childDataProducts); } - return dataResource; + return dataProduct; } public static DataReplicaLocationModel getDataReplicaLocationModel(DataReplicaLocation replicaLocation){ if (replicaLocation != null) { DataReplicaLocationModel replicaLocationModel = new DataReplicaLocationModel(); replicaLocationModel.setReplicaId(replicaLocation.getReplicaId()); - replicaLocationModel.setResourceId(replicaLocation.getResourceId()); + replicaLocationModel.setProductId(replicaLocation.getProductId()); replicaLocationModel.setReplicaName(replicaLocation.getReplicaName()); replicaLocationModel.setReplicaDescription(replicaLocation.getReplicaDescription()); replicaLocationModel.setStorageResourceId(replicaLocation.getStorageResourceId()); if(replicaLocation.getValidUntilTime() != null) replicaLocationModel.setValidUntilTime(replicaLocation.getValidUntilTime().getTime()); - replicaLocationModel.setFileAbsolutePath(replicaLocation.getFileAbsolutePath()); + replicaLocationModel.setFilePath(replicaLocation.getFileAbsolutePath()); if(replicaLocation.getCreationTime() != null) replicaLocationModel.setCreationTime(replicaLocation.getCreationTime().getTime()); if(replicaLocation.getLastModifiedTime() != null) replicaLocationModel.setLastModifiedTime(replicaLocation.getLastModifiedTime().getTime()); if(replicaLocation.getReplicaLocationCategory() != null) replicaLocationModel.setReplicaLocationCategory(ReplicaLocationCategory.valueOf(replicaLocation - .getReplicaLocationCategory().toString())); + .getReplicaLocationCategory().toString())); if(replicaLocation.getReplicaPersistentType() != null) replicaLocationModel.setReplicaPersistentType(ReplicaPersistentType.valueOf(replicaLocation - .getReplicaPersistentType().toString())); + .getReplicaPersistentType().toString())); replicaLocationModel.setReplicaMetadata(getReplicaMetaData(replicaLocation.getDataReplicaMetaData())); return replicaLocationModel; } @@ -165,11 +165,11 @@ public class ThriftDataModelConversion { public static DataReplicaLocation getUpdatedDataReplicaLocation(DataReplicaLocationModel dataReplicaLocationModel, DataReplicaLocation dataReplicaLocation){ dataReplicaLocation.setReplicaId(dataReplicaLocationModel.getReplicaId()); - dataReplicaLocation.setResourceId(dataReplicaLocationModel.getResourceId()); + dataReplicaLocation.setProductId(dataReplicaLocationModel.getProductId()); dataReplicaLocation.setReplicaName(dataReplicaLocationModel.getReplicaName()); dataReplicaLocation.setReplicaDescription(dataReplicaLocationModel.getReplicaDescription()); dataReplicaLocation.setStorageResourceId(dataReplicaLocationModel.getStorageResourceId()); - dataReplicaLocation.setFileAbsolutePath(dataReplicaLocationModel.getFileAbsolutePath()); + dataReplicaLocation.setFileAbsolutePath(dataReplicaLocationModel.getFilePath()); if(dataReplicaLocationModel.getValidUntilTime() > 0) dataReplicaLocation.setValidUntilTime(new Timestamp(dataReplicaLocationModel.getValidUntilTime())); if(dataReplicaLocationModel.getCreationTime() > 0) @@ -185,7 +185,7 @@ public class ThriftDataModelConversion { dataReplicaLocationModel.getReplicaMetadata().keySet().stream().forEach(k -> { String v = dataReplicaLocationModel.getReplicaMetadata().get(k); DataReplicaMetaData temp = new DataReplicaMetaData(); - temp.setReplicaId(dataReplicaLocationModel.getResourceId()); + temp.setReplicaId(dataReplicaLocationModel.getProductId()); temp.setKey(k); temp.setValue(v); dataReplicaMetadata.add(temp); @@ -195,10 +195,10 @@ public class ThriftDataModelConversion { return dataReplicaLocation; } - public static Map<String, String> getResourceMetaData(Collection<DataResourceMetaData> dataResourceMetaData){ + public static Map<String, String> getResourceMetaData(Collection<DataProductMetaData> dataProductMetaData){ HashMap<String, String> metadata = new HashMap<>(); - if(dataResourceMetaData!=null && !dataResourceMetaData.isEmpty()) { - dataResourceMetaData.stream().forEach(m -> metadata.put(m.getKey(),m.getValue())); + if(dataProductMetaData!=null && !dataProductMetaData.isEmpty()) { + dataProductMetaData.stream().forEach(m -> metadata.put(m.getKey(),m.getValue())); } return metadata; } http://git-wip-us.apache.org/repos/asf/airavata/blob/a963d3f0/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml b/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml index cb7c6b1..54215fa 100644 --- a/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml +++ b/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml @@ -95,9 +95,9 @@ </persistence-unit> <persistence-unit name="datacatalog_data"> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> - <class>org.apache.airavata.registry.core.data.catalog.model.DataResource</class> + <class>org.apache.airavata.registry.core.data.catalog.model.DataProduct</class> <class>org.apache.airavata.registry.core.data.catalog.model.DataReplicaLocation</class> - <class>org.apache.airavata.registry.core.data.catalog.model.DataResourceMetaData</class> + <class>org.apache.airavata.registry.core.data.catalog.model.DataProductMetaData</class> <class>org.apache.airavata.registry.core.data.catalog.model.DataReplicaMetaData</class> <class>org.apache.airavata.registry.core.data.catalog.model.Configuration</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> http://git-wip-us.apache.org/repos/asf/airavata/blob/a963d3f0/modules/registry/registry-core/src/main/resources/datacatalog-derby.sql ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/resources/datacatalog-derby.sql b/modules/registry/registry-core/src/main/resources/datacatalog-derby.sql index 2f39a54..56b8b65 100644 --- a/modules/registry/registry-core/src/main/resources/datacatalog-derby.sql +++ b/modules/registry/registry-core/src/main/resources/datacatalog-derby.sql @@ -19,24 +19,24 @@ * */ -CREATE TABLE DATA_RESOURCE +CREATE TABLE DATA_PRODUCT ( - RESOURCE_ID VARCHAR (255), + PRODUCT_ID VARCHAR (255), GATEWAY_ID VARCHAR (255), - RESOURCE_NAME VARCHAR (255), - RESOURCE_DESCRIPTION VARCHAR (1024), - PARENT_RESOURCE_ID VARCHAR (255), + PRODUCT_NAME VARCHAR (255), + PRODUCT_DESCRIPTION VARCHAR (1024), + PARENT_PRODUCT_ID VARCHAR (255), OWNER_NAME VARCHAR (255), - RESOURCE_SIZE INTEGER , + PRODUCT_SIZE INTEGER , CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, LAST_MODIFIED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (RESOURCE_ID) + PRIMARY KEY (PRODUCT_ID) ); CREATE TABLE DATA_REPLICA_LOCATION ( REPLICA_ID VARCHAR (255), - RESOURCE_ID VARCHAR (255) NOT NULL, + PRODUCT_ID VARCHAR (255) NOT NULL, REPLICA_NAME VARCHAR (255), REPLICA_DESCRIPTION VARCHAR (1024), STORAGE_RESOURCE_ID VARCHAR (255), @@ -45,16 +45,16 @@ CREATE TABLE DATA_REPLICA_LOCATION LAST_MODIFIED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', VALID_UNTIL_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (REPLICA_ID), - FOREIGN KEY (RESOURCE_ID) REFERENCES DATA_RESOURCE(RESOURCE_ID) ON DELETE CASCADE + FOREIGN KEY (PRODUCT_ID) REFERENCES DATA_PRODUCT(PRODUCT_ID) ON DELETE CASCADE ); -CREATE TABLE DATA_RESOURCE_METADATA +CREATE TABLE DATA_PRODUCT_METADATA ( - RESOURCE_ID VARCHAR(255), + PRODUCT_ID VARCHAR(255), METADATA_KEY VARCHAR(255), METADATA_VALUE VARCHAR(2048), - PRIMARY KEY(RESOURCE_ID, METADATA_KEY), - FOREIGN KEY (RESOURCE_ID) REFERENCES DATA_RESOURCE(RESOURCE_ID) ON DELETE CASCADE + PRIMARY KEY(PRODUCT_ID, METADATA_KEY), + FOREIGN KEY (PRODUCT_ID) REFERENCES DATA_PRODUCT(PRODUCT_ID) ON DELETE CASCADE ); CREATE TABLE DATA_REPLICA_METADATA http://git-wip-us.apache.org/repos/asf/airavata/blob/a963d3f0/modules/registry/registry-core/src/test/java/org/apache/airavata/data/catalog/DataCatalogTest.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/data/catalog/DataCatalogTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/data/catalog/DataCatalogTest.java index b8cc159..3e9f598 100644 --- a/modules/registry/registry-core/src/test/java/org/apache/airavata/data/catalog/DataCatalogTest.java +++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/data/catalog/DataCatalogTest.java @@ -21,11 +21,14 @@ package org.apache.airavata.data.catalog; import org.apache.airavata.data.catalog.util.Initialize; -import org.apache.airavata.model.data.resource.*; +import org.apache.airavata.model.data.product.*; import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory; import org.apache.airavata.registry.cpi.DataCatalog; import org.apache.airavata.registry.cpi.DataCatalogException; -import org.junit.*; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,7 +40,7 @@ public class DataCatalogTest { private final static Logger logger = LoggerFactory.getLogger(DataCatalogTest.class); private static Initialize initialize; private static DataCatalog datacatalog; - private static DataResourceModel dataResourceModel; + private static DataProductModel dataProductModel; private static DataReplicaLocationModel replicaLocationModel; @BeforeClass @@ -47,11 +50,11 @@ public class DataCatalogTest { initialize = new Initialize("datacatalog-derby.sql"); initialize.initializeDB(); datacatalog = RegistryFactory.getDataCatalog(); - dataResourceModel = new DataResourceModel(); - dataResourceModel.setResourceName("test-file.txt"); + dataProductModel = new DataProductModel(); + dataProductModel.setProductName("test-file.txt"); HashMap<String, String> resMetadata = new HashMap<>(); resMetadata.put("name", "name"); - dataResourceModel.setResourceMetadata(resMetadata); + dataProductModel.setProductMetadata(resMetadata); replicaLocationModel = new DataReplicaLocationModel(); replicaLocationModel.setReplicaName("1-st-replica"); @@ -60,7 +63,7 @@ public class DataCatalogTest { HashMap<String, String> rMetadata = new HashMap<>(); rMetadata.put("name", "name"); replicaLocationModel.setReplicaMetadata(rMetadata); - dataResourceModel.addToReplicaLocations(replicaLocationModel); + dataProductModel.addToReplicaLocations(replicaLocationModel); } catch (DataCatalogException e) { logger.error(e.getMessage(), e); } @@ -73,10 +76,10 @@ public class DataCatalogTest { } @Test - public void testPublishDataResource(){ + public void testPublishDataProduct(){ try { - String resourceId = datacatalog.registerResource(dataResourceModel); - org.junit.Assert.assertNotNull(resourceId); + String productId = datacatalog.registerDataProduct(dataProductModel); + org.junit.Assert.assertNotNull(productId); } catch (DataCatalogException e) { e.printStackTrace(); Assert.fail(); @@ -84,15 +87,15 @@ public class DataCatalogTest { } @Test - public void testRemoveDataResource(){ + public void testRemoveDataProduct(){ try { - boolean result = datacatalog.removeResource("234234234"); + boolean result = datacatalog.removeDataProduct("234234234"); Assert.assertFalse(result); - String resourceId = datacatalog.registerResource(dataResourceModel); - Assert.assertNotNull(resourceId); - result = datacatalog.removeResource(resourceId); + String productId = datacatalog.registerDataProduct(dataProductModel); + Assert.assertNotNull(productId); + result = datacatalog.removeDataProduct(productId); Assert.assertTrue(result); - result = datacatalog.removeResource(resourceId); + result = datacatalog.removeDataProduct(productId); Assert.assertFalse(result); } catch (DataCatalogException e) { e.printStackTrace(); @@ -101,19 +104,19 @@ public class DataCatalogTest { } @Test - public void testGetDataResource(){ + public void testGetDataProduct(){ try { - dataResourceModel.setDataResourceType(DataResourceType.COLLECTION); - String resourceId = datacatalog.registerResource(dataResourceModel); - Assert.assertNotNull(resourceId); - DataResourceModel persistedCopy = datacatalog.getResource(resourceId); + dataProductModel.setDataProductType(DataProductType.COLLECTION); + String productId = datacatalog.registerDataProduct(dataProductModel); + Assert.assertNotNull(productId); + DataProductModel persistedCopy = datacatalog.getDataProduct(productId); Assert.assertNotNull(persistedCopy); - dataResourceModel.setParentResourceId(resourceId); - dataResourceModel.setDataResourceType(DataResourceType.FILE); - datacatalog.registerResource(dataResourceModel); - datacatalog.registerResource(dataResourceModel); - persistedCopy = datacatalog.getResource(resourceId); - Assert.assertTrue(persistedCopy.getChildResources().size()==2); + dataProductModel.setParentProductId(productId); + dataProductModel.setDataProductType(DataProductType.FILE); + datacatalog.registerDataProduct(dataProductModel); + datacatalog.registerDataProduct(dataProductModel); + persistedCopy = datacatalog.getDataProduct(productId); + Assert.assertTrue(persistedCopy.getChildProducts().size()==2); } catch (DataCatalogException e) { e.printStackTrace(); Assert.fail(); @@ -121,21 +124,21 @@ public class DataCatalogTest { } @Test - public void testUpdateDataResource(){ + public void testUpdateDataProduct(){ try { - dataResourceModel.setResourceId(UUID.randomUUID().toString()); - boolean result = datacatalog.updateResource(dataResourceModel); + dataProductModel.setProductId(UUID.randomUUID().toString()); + boolean result = datacatalog.updateDataProduct(dataProductModel); Assert.assertFalse(result); - datacatalog.registerResource(dataResourceModel); - dataResourceModel.setResourceName("updated-name"); - datacatalog.updateResource(dataResourceModel); - dataResourceModel = datacatalog.getResource(dataResourceModel.getResourceId()); - Assert.assertTrue(dataResourceModel.getResourceName().equals("updated-name")); - Assert.assertTrue(dataResourceModel.getResourceMetadata().size()==1); - dataResourceModel.getResourceMetadata().put("name2","name2"); - datacatalog.updateResource(dataResourceModel); - dataResourceModel = datacatalog.getResource(dataResourceModel.getResourceId()); - Assert.assertTrue(dataResourceModel.getResourceMetadata().size()==2); + datacatalog.registerDataProduct(dataProductModel); + dataProductModel.setProductName("updated-name"); + datacatalog.updateDataProduct(dataProductModel); + dataProductModel = datacatalog.getDataProduct(dataProductModel.getProductId()); + Assert.assertTrue(dataProductModel.getProductName().equals("updated-name")); + Assert.assertTrue(dataProductModel.getProductMetadata().size()==1); + dataProductModel.getProductMetadata().put("name2","name2"); + datacatalog.updateDataProduct(dataProductModel); + dataProductModel = datacatalog.getDataProduct(dataProductModel.getProductId()); + Assert.assertTrue(dataProductModel.getProductMetadata().size()==2); } catch (DataCatalogException e) { e.printStackTrace(); Assert.fail(); @@ -145,8 +148,8 @@ public class DataCatalogTest { @Test public void testPublishReplicaLocation(){ try { - String resourceId = datacatalog.registerResource(dataResourceModel); - replicaLocationModel.setResourceId(resourceId); + String productId = datacatalog.registerDataProduct(dataProductModel); + replicaLocationModel.setProductId(productId); String replicaId = datacatalog.registerReplicaLocation(replicaLocationModel); Assert.assertNotNull(replicaId);; } catch (DataCatalogException e) { @@ -158,8 +161,8 @@ public class DataCatalogTest { @Test public void testRemoveReplicaLocation(){ try { - String resourceId = datacatalog.registerResource(dataResourceModel); - replicaLocationModel.setResourceId(resourceId); + String productId = datacatalog.registerDataProduct(dataProductModel); + replicaLocationModel.setProductId(productId); String replicaId = datacatalog.registerReplicaLocation(replicaLocationModel); boolean result = datacatalog.removeReplicaLocation(replicaId); Assert.assertTrue(result); @@ -174,8 +177,8 @@ public class DataCatalogTest { @Test public void testGetReplicaLocation(){ try { - String resourceId = datacatalog.registerResource(dataResourceModel); - replicaLocationModel.setResourceId(resourceId); + String productId = datacatalog.registerDataProduct(dataProductModel); + replicaLocationModel.setProductId(productId); String replicaId = datacatalog.registerReplicaLocation(replicaLocationModel); DataReplicaLocationModel persistedCopy = datacatalog.getReplicaLocation(replicaId); Assert.assertNotNull(persistedCopy); @@ -188,8 +191,8 @@ public class DataCatalogTest { @Test public void testUpdateReplicaLocation(){ try { - String resourceId = datacatalog.registerResource(dataResourceModel); - replicaLocationModel.setResourceId(resourceId); + String productId = datacatalog.registerDataProduct(dataProductModel); + replicaLocationModel.setProductId(productId); String replicaId = datacatalog.registerReplicaLocation(replicaLocationModel); DataReplicaLocationModel persistedCopy = datacatalog.getReplicaLocation(replicaId); persistedCopy.setReplicaDescription("updated-description"); @@ -206,10 +209,10 @@ public class DataCatalogTest { @Test public void testGetAllReplicaLocations(){ try { - String resourceId = datacatalog.registerResource(dataResourceModel); - replicaLocationModel.setResourceId(resourceId); + String productId = datacatalog.registerDataProduct(dataProductModel); + replicaLocationModel.setProductId(productId); datacatalog.registerReplicaLocation(replicaLocationModel); - List<DataReplicaLocationModel> replicaLocationModelList = datacatalog.getAllReplicaLocations(resourceId); + List<DataReplicaLocationModel> replicaLocationModelList = datacatalog.getAllReplicaLocations(productId); Assert.assertNotNull(replicaLocationModelList.get(0).getReplicaId()); } catch (DataCatalogException e) { e.printStackTrace(); http://git-wip-us.apache.org/repos/asf/airavata/blob/a963d3f0/modules/registry/registry-core/src/test/resources/datacatalog-derby.sql ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/test/resources/datacatalog-derby.sql b/modules/registry/registry-core/src/test/resources/datacatalog-derby.sql deleted file mode 100644 index 3091447..0000000 --- a/modules/registry/registry-core/src/test/resources/datacatalog-derby.sql +++ /dev/null @@ -1,52 +0,0 @@ -/* - * - * 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. - * - */ - -CREATE TABLE DATA_RESOURCE -( - RESOURCE_ID VARCHAR (255), - RESOURCE_NAME VARCHAR (255), - RESOURCE_DESCRIPTION VARCHAR (1024), - RESOURCE_SIZE INTEGER , - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - LAST_MODIFIED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (RESOURCE_ID) -); - -CREATE TABLE DATA_REPLICA_LOCATION -( - RESOURCE_ID VARCHAR (255), - REPLICA_NAME VARCHAR (255), - REPLICA_DESCRIPTION VARCHAR (1024), - DATA_LOCATIONS VARCHAR (4096), - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - LAST_MODIFIED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - FOREIGN KEY (RESOURCE_ID) REFERENCES DATA_RESOURCE(RESOURCE_ID) ON DELETE CASCADE -); - - -CREATE TABLE CONFIGURATION -( - CONFIG_KEY VARCHAR(255), - CONFIG_VAL VARCHAR(255), - PRIMARY KEY(CONFIG_KEY, CONFIG_VAL) -); - -INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL) VALUES('data_catalog_version', '0.16'); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/a963d3f0/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/DataCatalog.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/DataCatalog.java b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/DataCatalog.java index a2e1c9a..49ae6f5 100644 --- a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/DataCatalog.java +++ b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/DataCatalog.java @@ -19,19 +19,21 @@ package org.apache.airavata.registry.cpi; -import org.apache.airavata.model.data.resource.*; + +import org.apache.airavata.model.data.product.DataProductModel; +import org.apache.airavata.model.data.product.DataReplicaLocationModel; import java.util.List; public interface DataCatalog { - String registerResource(DataResourceModel resource) throws DataCatalogException; + String registerDataProduct(DataProductModel resource) throws DataCatalogException; - boolean removeResource(String resourceId) throws DataCatalogException; + boolean removeDataProduct(String resourceId) throws DataCatalogException; - boolean updateResource(DataResourceModel resource) throws DataCatalogException; + boolean updateDataProduct(DataProductModel resource) throws DataCatalogException; - DataResourceModel getResource(String resourceId) throws DataCatalogException; + DataProductModel getDataProduct(String resourceId) throws DataCatalogException; String registerReplicaLocation(DataReplicaLocationModel dataReplicaLocationModel) throws DataCatalogException; http://git-wip-us.apache.org/repos/asf/airavata/blob/a963d3f0/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/DataCatalogException.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/DataCatalogException.java b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/DataCatalogException.java index dbb0ee4..9bc4da9 100644 --- a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/DataCatalogException.java +++ b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/DataCatalogException.java @@ -20,7 +20,6 @@ package org.apache.airavata.registry.cpi; public class DataCatalogException extends Exception{ - private static final long serialVersionUID = -2849422320739447602L; public DataCatalogException(Throwable e) { super(e); http://git-wip-us.apache.org/repos/asf/airavata/blob/a963d3f0/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 2a44091..60c53a6 100644 --- a/pom.xml +++ b/pom.xml @@ -551,7 +551,6 @@ <module>modules/commons</module> <module>modules/messaging</module> <module>modules/gfac</module> - <module>modules/data-manager</module> <module>modules/registry</module> <module>modules/security</module> <module>modules/credential-store</module> http://git-wip-us.apache.org/repos/asf/airavata/blob/a963d3f0/thrift-interface-descriptions/airavata-apis/airavata_api.thrift ---------------------------------------------------------------------- diff --git a/thrift-interface-descriptions/airavata-apis/airavata_api.thrift b/thrift-interface-descriptions/airavata-apis/airavata_api.thrift index ec54d2b..3e6f70a 100644 --- a/thrift-interface-descriptions/airavata-apis/airavata_api.thrift +++ b/thrift-interface-descriptions/airavata-apis/airavata_api.thrift @@ -40,7 +40,7 @@ include "../data-models/resource-catalog-models/storage_resource_model.thrift" include "../data-models/resource-catalog-models/gateway_resource_profile_model.thrift" include "../data-models/resource-catalog-models/data_movement_models.thrift" include "../data-models/workflow-models/workflow_data_model.thrift" -include "../data-models/data-catalog-models/replica_catalog_models.thrift" +include "../data-models/data-catalog-models/data_catalog_models.thrift" namespace java org.apache.airavata.api namespace php Airavata.API @@ -2153,7 +2153,7 @@ service Airavata { * Add a Local data movement details to a compute resource * App catalog will return a dataMovementInterfaceId which will be added to the dataMovementInterfaces. * - * @param resourceId + * @param productId * The identifier of the compute resource to which JobSubmission protocol to be added * * @param DMType @@ -2170,7 +2170,7 @@ service Airavata { * **/ string addLocalDataMovementDetails(1: required security_model.AuthzToken authzToken, - 2: required string resourceId, + 2: required string productId, 3: required data_movement_models.DMType dataMoveType, 4: required i32 priorityOrder, 5: required data_movement_models.LOCALDataMovement localDataMovement) @@ -2223,7 +2223,7 @@ service Airavata { * Add a SCP data movement details to a compute resource * App catalog will return a dataMovementInterfaceId which will be added to the dataMovementInterfaces. * - * @param resourceId + * @param productId * The identifier of the compute resource to which JobSubmission protocol to be added * * @param priorityOrder @@ -2237,7 +2237,7 @@ service Airavata { * */ string addSCPDataMovementDetails(1: required security_model.AuthzToken authzToken, - 2: required string resourceId, + 2: required string productId, 3: required data_movement_models.DMType dataMoveType, 4: required i32 priorityOrder, 5: required data_movement_models.SCPDataMovement scpDataMovement) @@ -2289,7 +2289,7 @@ service Airavata { * Add a UNICORE data movement details to a compute resource * App catalog will return a dataMovementInterfaceId which will be added to the dataMovementInterfaces. * - * @param resourceId + * @param productId * The identifier of the compute resource to which data movement protocol to be added * * @param priorityOrder @@ -2303,7 +2303,7 @@ service Airavata { * */ string addUnicoreDataMovementDetails(1: required security_model.AuthzToken authzToken, - 2: required string resourceId, + 2: required string productId, 3: required data_movement_models.DMType dataMoveType, 4: required i32 priorityOrder, 5: required data_movement_models.UnicoreDataMovement unicoreDataMovement) @@ -2358,7 +2358,7 @@ service Airavata { * Add a GridFTP data movement details to a compute resource * App catalog will return a dataMovementInterfaceId which will be added to the dataMovementInterfaces. * - * @param resourceId + * @param productId * The identifier of the compute resource to which dataMovement protocol to be added * * @param DMType @@ -2376,7 +2376,7 @@ service Airavata { **/ string addGridFTPDataMovementDetails(1: required security_model.AuthzToken authzToken, - 2: required string resourceId, + 2: required string productId, 3: required data_movement_models.DMType dataMoveType, 4: required i32 priorityOrder, 5: required data_movement_models.GridFTPDataMovement gridFTPDataMovement) @@ -2529,7 +2529,7 @@ service Airavata { * **/ - bool deleteDataMovementInterface(1: required security_model.AuthzToken authzToken, 2: required string resourceId, + bool deleteDataMovementInterface(1: required security_model.AuthzToken authzToken, 2: required string productId, 3: required string dataMovementInterfaceId, 4: required data_movement_models.DMType dataMoveType,) throws (1: airavata_errors.InvalidRequestException ire, @@ -2959,55 +2959,6 @@ service Airavata { 2: airavata_errors.AiravataClientException ace, 3: airavata_errors.AiravataSystemException ase, 4: airavata_errors.AuthorizationException ae) - - /** - * - * Data Manager Related API Methods. - * - **/ - string registerDataResource(1: required security_model.AuthzToken authzToken, 2: required replica_catalog_models.DataResourceModel dataResourceModel) - throws (1: airavata_errors.InvalidRequestException ire, - 2: airavata_errors.AiravataClientException ace, - 3: airavata_errors.AiravataSystemException ase, - 4: airavata_errors.AuthorizationException ae) - - void updateDataResource(1: required security_model.AuthzToken authzToken, 2: required replica_catalog_models.DataResourceModel dataResourceModel) - throws (1: airavata_errors.InvalidRequestException ire, - 2: airavata_errors.AiravataClientException ace, - 3: airavata_errors.AiravataSystemException ase, - 4: airavata_errors.AuthorizationException ae) - - void removeDataResource(1: required security_model.AuthzToken authzToken, 2: required string resourceId) - throws (1: airavata_errors.InvalidRequestException ire, - 2: airavata_errors.AiravataClientException ace, - 3: airavata_errors.AiravataSystemException ase, - 4: airavata_errors.AuthorizationException ae) - - replica_catalog_models.DataResourceModel getDataResource(1: required security_model.AuthzToken authzToken, 2: required string resourceId) - throws (1: airavata_errors.InvalidRequestException ire, - 2: airavata_errors.AiravataClientException ace, - 3: airavata_errors.AiravataSystemException ase, - 4: airavata_errors.AuthorizationException ae) - - string copyDataResource(1: required security_model.AuthzToken authzToken, - 2: required string resourceId, - 3: required string destStorageResourceId, - 4: required string destinationParentPath) - throws (1: airavata_errors.InvalidRequestException ire, - 2: airavata_errors.AiravataClientException ace, - 3: airavata_errors.AiravataSystemException ase, - 4: airavata_errors.AuthorizationException ae) - - string copyDataReplica(1: required security_model.AuthzToken authzToken, - 2: required string resourceId, - 3: required string replicaId, - 4: required string destStorageResourceId, - 5: required string destinationParentPath) - throws (1: airavata_errors.InvalidRequestException ire, - 2: airavata_errors.AiravataClientException ace, - 3: airavata_errors.AiravataSystemException ase, - 4: airavata_errors.AuthorizationException ae) - //End of API } http://git-wip-us.apache.org/repos/asf/airavata/blob/a963d3f0/thrift-interface-descriptions/data-models/airavata_data_models.thrift ---------------------------------------------------------------------- diff --git a/thrift-interface-descriptions/data-models/airavata_data_models.thrift b/thrift-interface-descriptions/data-models/airavata_data_models.thrift index 7cb9fd4..12ac253 100644 --- a/thrift-interface-descriptions/data-models/airavata_data_models.thrift +++ b/thrift-interface-descriptions/data-models/airavata_data_models.thrift @@ -30,7 +30,7 @@ include "experiment-catalog-models/process_model.thrift" include "experiment-catalog-models/scheduling_model.thrift" include "experiment-catalog-models/status_models.thrift" include "resource-catalog-models/data_movement_models.thrift" -include "data-catalog-models/replica_catalog_models.thrift" +include "data-catalog-models/data_catalog_models.thrift" namespace java org.apache.airavata.model namespace php Airavata.Model http://git-wip-us.apache.org/repos/asf/airavata/blob/a963d3f0/thrift-interface-descriptions/data-models/data-catalog-models/data_catalog_models.thrift ---------------------------------------------------------------------- diff --git a/thrift-interface-descriptions/data-models/data-catalog-models/data_catalog_models.thrift b/thrift-interface-descriptions/data-models/data-catalog-models/data_catalog_models.thrift new file mode 100644 index 0000000..19454bd --- /dev/null +++ b/thrift-interface-descriptions/data-models/data-catalog-models/data_catalog_models.thrift @@ -0,0 +1,72 @@ +/* + * 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. + * + */ + namespace java org.apache.airavata.model.data.product + namespace php Airavata.Model.Data.Product + namespace cpp apache.airavata.model.data.product + namespace py apache.airavata.model.data.product + +enum ReplicaLocationCategory { + GATEWAY_DATA_STORE, + COMPUTE_RESOURCE, + LONG_TERM_STORAGE_RESOURCE, + OTHER +} + +enum ReplicaPersistentType { + TRANSIENT, + PERSISTENT +} + +enum DataProductType { + DIR, + FILE, + COLLECTION, +} + +struct DataProductModel { + 1: optional string productId, + 2: optional string gatewayId, + 3: optional string parentProductId, + 4: optional string productName, + 5: optional string productDescription, + 6: optional string ownerName, + 7: optional DataProductType dataProductType, + 8: optional i32 productSize, + 9: optional i64 creationTime, + 10: optional i64 lastModifiedTime, + 11: optional map<string, string> productMetadata, + 12: optional list<DataReplicaLocationModel> replicaLocations, + 13: optional list<DataProductModel> childProducts +} + +struct DataReplicaLocationModel { + 1: optional string replicaId, + 2: optional string productId, + 3: optional string replicaName, + 4: optional string replicaDescription, + 5: optional i64 creationTime, + 6: optional i64 lastModifiedTime, + 7: optional i64 validUntilTime, + 8: optional ReplicaLocationCategory replicaLocationCategory, + 9: optional ReplicaPersistentType replicaPersistentType, + 10: optional string storageResourceId, + 11: optional string filePath, + 12: optional map<string, string> replicaMetadata +} http://git-wip-us.apache.org/repos/asf/airavata/blob/a963d3f0/thrift-interface-descriptions/data-models/data-catalog-models/replica_catalog_models.thrift ---------------------------------------------------------------------- diff --git a/thrift-interface-descriptions/data-models/data-catalog-models/replica_catalog_models.thrift b/thrift-interface-descriptions/data-models/data-catalog-models/replica_catalog_models.thrift deleted file mode 100644 index 6b344fb..0000000 --- a/thrift-interface-descriptions/data-models/data-catalog-models/replica_catalog_models.thrift +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - * - */ - - include "../resource-catalog-models/data_movement_models.thrift" - - namespace java org.apache.airavata.model.data.resource - namespace php Airavata.Model.Data.Resource - namespace cpp apache.airavata.model.data.resource - namespace py apache.airavata.model.data.resource - -enum ReplicaLocationCategory { - GATEWAY_DATA_STORE, - COMPUTE_RESOURCE, - LONG_TERM_STORAGE_RESOURCE, - OTHER -} - -enum ReplicaPersistentType { - TRANSIENT, - PERSISTENT -} - -enum DataResourceType { - COLLECTION, - FILE -} - -struct DataResourceModel { - 1: optional string resourceId, - 2: optional string gatewayId, - 3: optional string parentResourceId, - 4: optional string resourceName, - 5: optional string resourceDescription, - 6: optional string ownerName, - 7: optional DataResourceType dataResourceType, - 8: optional i32 resourceSize, - 9: optional i64 creationTime, - 10: optional i64 lastModifiedTime, - 11: optional map<string, string> resourceMetadata, - 12: optional list<DataReplicaLocationModel> replicaLocations, - 13: optional list<DataResourceModel> childResources -} - -struct DataReplicaLocationModel { - 1: optional string replicaId, - 2: optional string resourceId, - 3: optional string replicaName, - 4: optional string replicaDescription, - 5: optional i64 creationTime, - 6: optional i64 lastModifiedTime, - 7: optional i64 validUntilTime, - 8: optional ReplicaLocationCategory replicaLocationCategory, - 9: optional ReplicaPersistentType replicaPersistentType, - 10: optional string storageResourceId, - 11: optional string fileAbsolutePath, - 12: optional map<string, string> replicaMetadata -}
