Fixing Exporter

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/is-exporter-se-plugin@177013 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2019-02-06 11:49:43 +00:00
parent 5e00714c1b
commit 41111b3b74
4 changed files with 79 additions and 88 deletions

View File

@ -48,10 +48,8 @@ public class ISExporterPlugin extends Plugin<ISExporterPluginDeclaration> {
logger.debug("Failure Report are filtered (e.g. Failing UUID are not shown to avoid to produce to much uneeded reports)");
/*
GenericResourceExporter genericResourceExporter = new GenericResourceExporter(filteredReport);
genericResourceExporter.export();
*/
ServiceEndpointExporter serviceEndpointExporter = new ServiceEndpointExporter(filteredReport);
serviceEndpointExporter.export();

View File

@ -22,9 +22,9 @@ import org.gcube.informationsystem.exporter.mapper.exception.UpdateException;
import org.gcube.informationsystem.model.reference.ISConstants;
import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceAvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisher;
@ -131,9 +131,9 @@ public abstract class GCoreResourceMapper<GR extends org.gcube.common.resources.
try {
update = resourceRegistryClient.exists(rClass, uuid);
} catch (NotFoundException e) {
} catch (ResourceNotFoundException e) {
update = false;
} catch (AvailableInAnotherContextException e) {
} catch (ResourceAvailableInAnotherContextException e) {
// This code should never be reached because this should be fixed in
// map function
resourceRegistryPublisher.addResourceToCurrentContext(r);

View File

@ -13,8 +13,8 @@ import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.model.reference.relations.IsIdentifiedBy;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceAvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException;
import org.gcube.resourcemanagement.model.impl.entities.facets.SimpleFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.SoftwareFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.resources.ConfigurationImpl;
@ -45,15 +45,14 @@ public class GenericResourceExporter extends GCoreResourceMapper<GenericResource
try {
readFromIS = resourceRegistryClient.exists(rClass, uuid);
}catch (NotFoundException e) {
} catch(ResourceNotFoundException e) {
readFromIS = false;
} catch (AvailableInAnotherContextException e) {
} catch(ResourceAvailableInAnotherContextException e) {
resourceRegistryPublisher.addResourceToCurrentContext(Configuration.NAME, uuid);
Thread.sleep(100);
readFromIS = true;
}
if(readFromIS) {
configuration = read(uuid);
//softwareFacet = (SoftwareFacet) configuration.getIdentificationFacets().get(0);
@ -86,12 +85,11 @@ public class GenericResourceExporter extends GCoreResourceMapper<GenericResource
/* ----------------------------------------- */
if(softwareFacet == null) {
softwareFacet = new SoftwareFacetImpl();
IsIdentifiedBy<Configuration, SoftwareFacet> identifiedBy =
new IsIdentifiedByImpl<Configuration, SoftwareFacet>(configuration, softwareFacet, null);
IsIdentifiedBy<Configuration,SoftwareFacet> identifiedBy = new IsIdentifiedByImpl<Configuration,SoftwareFacet>(
configuration, softwareFacet, null);
configuration.addFacet(identifiedBy);
}
softwareFacet.setGroup(profile.type());
softwareFacet.setName(profile.name());
softwareFacet.setVersion(FIXED_VERSION);

View File

@ -21,8 +21,8 @@ import org.gcube.informationsystem.model.reference.properties.Encrypted;
import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.model.reference.relations.IsIdentifiedBy;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceAvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException;
import org.gcube.informationsystem.utils.ISMapper;
import org.gcube.resourcemanagement.model.impl.entities.facets.AccessPointFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.NetworkingFacetImpl;
@ -81,9 +81,9 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
try {
readFromIS = resourceRegistryClient.exists(rClass, uuid);
}catch (NotFoundException e) {
} catch(ResourceNotFoundException e) {
readFromIS = false;
}catch (AvailableInAnotherContextException e) {
} catch(ResourceAvailableInAnotherContextException e) {
resourceRegistryPublisher.addResourceToCurrentContext(EService.NAME, uuid);
Thread.sleep(100);
readFromIS = true;
@ -150,8 +150,8 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
/* ----------------------------------------- */
if(softwareFacet == null) {
softwareFacet = new SoftwareFacetImpl();
IsIdentifiedBy<EService, SoftwareFacet> identifiedBy =
new IsIdentifiedByImpl<EService, SoftwareFacet>(eService, softwareFacet, null);
IsIdentifiedBy<EService,SoftwareFacet> identifiedBy = new IsIdentifiedByImpl<EService,SoftwareFacet>(
eService, softwareFacet, null);
eService.addFacet(identifiedBy);
}
@ -164,7 +164,6 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
}
/* ----------------------------------------- */
/* ----------------------------------------- */
Platform platform = profile.platform();
@ -175,13 +174,11 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
platformSoftwareFacet.setGroup(PLATFORM);
platformSoftwareFacet.setName(platform.name());
String platformVersion = String.format("%d.%d.%d-%d",
platform.version(), platform.minorVersion(),
String platformVersion = String.format("%d.%d.%d-%d", platform.version(), platform.minorVersion(),
platform.revisionVersion(), platform.buildVersion());
softwareFacet.setVersion(platformVersion);
/* ----------------------------------------- */
/* ----------------------------------------- */
Runtime runTime = profile.runtime();
@ -203,13 +200,13 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
/* ----------------------------------------- */
/* ----------------------------------------- */
int i = 0;
for(AccessPoint accessPoint : accessPoints) {
if(accessPointFacets[i] == null) {
accessPointFacets[i] = new AccessPointFacetImpl();
ConsistsOf<EService, AccessPointFacet> consistsOf = new ConsistsOfImpl<EService, AccessPointFacet>(eService, accessPointFacets[i], null);
ConsistsOf<EService,AccessPointFacet> consistsOf = new ConsistsOfImpl<EService,AccessPointFacet>(
eService, accessPointFacets[i], null);
consistsOf.setAdditionalProperty(POSITION, i);
eService.addFacet(consistsOf);
}
@ -243,7 +240,6 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
}
/* END Managing Username and Password */
/* Managing AccessPoint Properties */
Group<Property> properties = accessPoint.properties();
if(properties != null && properties.size() > 0) {
@ -277,7 +273,6 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
}
/* ----------------------------------------- */
return eService;
}