Implementing Facet Based IS solution
This commit is contained in:
parent
fef4bd8479
commit
2cc004df4c
|
@ -7,6 +7,8 @@ import org.gcube.gcat.configuration.isproxies.FacetBasedISConfigurationProxy;
|
|||
import org.gcube.gcat.configuration.isproxies.FacetBasedISConfigurationProxyFactory;
|
||||
import org.gcube.gcat.rest.RequestFilter;
|
||||
import org.gcube.smartgears.ApplicationManager;
|
||||
import org.gcube.smartgears.ContextProvider;
|
||||
import org.gcube.smartgears.context.application.ApplicationContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -44,7 +46,11 @@ public class GCatInitializator implements ApplicationManager {
|
|||
+ "-------------------------------------------------------",
|
||||
context);
|
||||
|
||||
ApplicationContext applicationContext = ContextProvider.get();
|
||||
String gcatEServiceID = applicationContext.id();
|
||||
|
||||
FacetBasedISConfigurationProxy facetBasedISConfigurationProxy = FacetBasedISConfigurationProxyFactory.getInstance(context);
|
||||
facetBasedISConfigurationProxy.setGcatEServiceID(gcatEServiceID);
|
||||
try {
|
||||
facetBasedISConfigurationProxy.createCallsForToVirtualService();
|
||||
}catch (Exception e) {
|
||||
|
@ -83,7 +89,11 @@ public class GCatInitializator implements ApplicationManager {
|
|||
context);
|
||||
|
||||
/*
|
||||
ApplicationContext applicationContext = ContextProvider.get();
|
||||
String gcatEServiceID = applicationContext.id();
|
||||
|
||||
FacetBasedISConfigurationProxy facetBasedISConfigurationProxy = FacetBasedISConfigurationProxyFactory.getInstance(context);
|
||||
facetBasedISConfigurationProxy.setGcatEServiceID(gcatEServiceID);
|
||||
try {
|
||||
facetBasedISConfigurationProxy.deleteCallsForToVirtualService();
|
||||
}catch (Exception e) {
|
||||
|
|
|
@ -51,8 +51,6 @@ import org.gcube.resourcemanagement.model.reference.entities.resources.Configura
|
|||
import org.gcube.resourcemanagement.model.reference.entities.resources.EService;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.resources.VirtualService;
|
||||
import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.CallsFor;
|
||||
import org.gcube.smartgears.ContextProvider;
|
||||
import org.gcube.smartgears.context.application.ApplicationContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -142,7 +140,8 @@ public class FacetBasedISConfigurationProxy extends ISConfigurationProxy<SimpleF
|
|||
|
||||
protected SimpleFacet configurationSimpleFacet;
|
||||
|
||||
|
||||
protected String gcatEServiceID;
|
||||
|
||||
public FacetBasedISConfigurationProxy(String context) {
|
||||
super(context);
|
||||
objectMapper = new ObjectMapper();
|
||||
|
@ -156,6 +155,10 @@ public class FacetBasedISConfigurationProxy extends ISConfigurationProxy<SimpleF
|
|||
}
|
||||
return virtualService;
|
||||
}
|
||||
|
||||
public void setGcatEServiceID(String gcatEServiceID) {
|
||||
this.gcatEServiceID = gcatEServiceID;
|
||||
}
|
||||
|
||||
protected String installQueryTemplate(ResourceRegistryQueryTemplateClient rrqtc) throws Exception {
|
||||
QueryTemplate queryTemplate = getQueryTemplate();
|
||||
|
@ -183,9 +186,6 @@ public class FacetBasedISConfigurationProxy extends ISConfigurationProxy<SimpleF
|
|||
queryTemplateName = installQueryTemplate(rrqtc);
|
||||
}
|
||||
|
||||
ApplicationContext applicationContext = ContextProvider.get();
|
||||
String gcatEServiceID = applicationContext.id();
|
||||
|
||||
ObjectNode objectNode = objectMapper.createObjectNode();
|
||||
objectNode.put(GCAT_ESERVICE_UUID_VARNAME, gcatEServiceID);
|
||||
|
||||
|
@ -221,8 +221,6 @@ public class FacetBasedISConfigurationProxy extends ISConfigurationProxy<SimpleF
|
|||
propagationConstraint.setAddConstraint(AddConstraint.unpropagate);
|
||||
propagationConstraint.setRemoveConstraint(RemoveConstraint.keep);
|
||||
EService gcatEService = new EServiceImpl();
|
||||
ApplicationContext applicationContext = ContextProvider.get();
|
||||
String gcatEServiceID = applicationContext.id();
|
||||
UUID gcatEServiceUUID = UUID.fromString(gcatEServiceID);
|
||||
gcatEService.setHeader(new HeaderImpl(gcatEServiceUUID));
|
||||
VirtualService virtualService = queryVirtualService();
|
||||
|
|
|
@ -1,32 +1,41 @@
|
|||
{
|
||||
"@class": "CallsFor",
|
||||
"source": {
|
||||
"@class": "EService",
|
||||
"header" : {
|
||||
"uuid" : "$uuid"
|
||||
},
|
||||
"consistsOf": [
|
||||
{
|
||||
"@class": "IsIdentifiedBy",
|
||||
"target": {
|
||||
"@class": "SoftwareFacet",
|
||||
"group": "org.gcube.data-catalogue",
|
||||
"name": "gcat"
|
||||
"@class" : "QueryTemplate",
|
||||
"name" : "GCat-Get-CallsFor-to-VirtualService",
|
||||
"description" : "The following query return all CallsFor relation from the EService of gcat identified by the UUID provided as parameter to the Virtual Service with name 'catalogue-virtual-service'. The content of the request to run this query template will be something like {\"$uuid\": \"335580b6-c164-4506-980a-21e5bcf8dbcf\"}",
|
||||
"template" : {
|
||||
"@class" : "CallsFor",
|
||||
"source" : {
|
||||
"@class" : "EService",
|
||||
"header" : {
|
||||
"uuid" : "$uuid"
|
||||
},
|
||||
"consistsOf" : [ {
|
||||
"@class" : "IsIdentifiedBy",
|
||||
"target" : {
|
||||
"@class" : "SoftwareFacet",
|
||||
"group" : "org.gcube.data-catalogue",
|
||||
"name" : "gcat"
|
||||
}
|
||||
}
|
||||
]
|
||||
} ]
|
||||
},
|
||||
"target" : {
|
||||
"@class" : "VirtualService",
|
||||
"consistsOf" : [ {
|
||||
"@class" : "IsIdentifiedBy",
|
||||
"target" : {
|
||||
"@class" : "SoftwareFacet",
|
||||
"group" : "org.gcube.data-catalogue",
|
||||
"name" : "catalogue-virtual-service"
|
||||
}
|
||||
} ]
|
||||
}
|
||||
},
|
||||
"target":{
|
||||
"@class": "VirtualService",
|
||||
"consistsOf": [
|
||||
{
|
||||
"@class": "IsIdentifiedBy",
|
||||
"target": {
|
||||
"@class": "SoftwareFacet",
|
||||
"group": "org.gcube.data-catalogue",
|
||||
"name": "catalogue-virtual-service"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
"templateVariables" : {
|
||||
"$uuid" : {
|
||||
"@class": "TemplateVariable",
|
||||
"name": "$uuid",
|
||||
"description": "The uuid of the gCat EService, e.g. 335580b6-c164-4506-980a-21e5bcf8dbcf. Please note that the default value has no meaning but we need a valid value so that the query can be tested by the resource-registry service.",
|
||||
"defaultValue": "335580b6-c164-4506-980a-21e5bcf8dbcf"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,6 +6,9 @@ import org.junit.Test;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public class CatalogueConfigurationFactoryTest extends ContextTest {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(CatalogueConfigurationFactoryTest.class);
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package org.gcube.gcat.configuration.isproxies;
|
||||
|
||||
import org.gcube.gcat.ContextTest;
|
||||
import org.gcube.gcat.configuration.service.ServiceCatalogueConfiguration;
|
||||
import org.gcube.informationsystem.utils.ElementMapper;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.SimpleFacet;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public class FacetBasedISConfigurationProxyTest extends ContextTest {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(FacetBasedISConfigurationProxyTest.class);
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
FacetBasedISConfigurationProxy fbiscp = FacetBasedISConfigurationProxyFactory.getInstance();
|
||||
fbiscp.setGcatEServiceID("f00bbacd-92b8-46d7-b41c-828f71a78753");
|
||||
fbiscp.createCallsForToVirtualService();
|
||||
|
||||
SimpleFacet simpleFacet = fbiscp.getISResource();
|
||||
logger.debug("{}", ElementMapper.marshal(simpleFacet));
|
||||
|
||||
ServiceCatalogueConfiguration catalogueConfiguration = fbiscp.getCatalogueConfiguration();
|
||||
logger.debug("{}", catalogueConfiguration.toJsonString());
|
||||
logger.debug("{}", catalogueConfiguration.toJsonString(true));
|
||||
|
||||
fbiscp.deleteCallsForToVirtualService();
|
||||
}
|
||||
|
||||
}
|
|
@ -6,3 +6,4 @@
|
|||
/config.properties.old
|
||||
/config.properties-new-authz
|
||||
/devvre.conf.json
|
||||
/config.ini
|
||||
|
|
Loading…
Reference in New Issue