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:
parent
5e00714c1b
commit
41111b3b74
|
@ -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)");
|
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 genericResourceExporter = new GenericResourceExporter(filteredReport);
|
||||||
genericResourceExporter.export();
|
genericResourceExporter.export();
|
||||||
*/
|
|
||||||
|
|
||||||
ServiceEndpointExporter serviceEndpointExporter = new ServiceEndpointExporter(filteredReport);
|
ServiceEndpointExporter serviceEndpointExporter = new ServiceEndpointExporter(filteredReport);
|
||||||
serviceEndpointExporter.export();
|
serviceEndpointExporter.export();
|
||||||
|
|
|
@ -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.ISConstants;
|
||||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
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.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.ResourceRegistryClient;
|
||||||
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
|
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
|
||||||
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisher;
|
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisher;
|
||||||
|
@ -131,9 +131,9 @@ public abstract class GCoreResourceMapper<GR extends org.gcube.common.resources.
|
||||||
|
|
||||||
try {
|
try {
|
||||||
update = resourceRegistryClient.exists(rClass, uuid);
|
update = resourceRegistryClient.exists(rClass, uuid);
|
||||||
} catch (NotFoundException e) {
|
} catch (ResourceNotFoundException e) {
|
||||||
update = false;
|
update = false;
|
||||||
} catch (AvailableInAnotherContextException e) {
|
} catch (ResourceAvailableInAnotherContextException e) {
|
||||||
// This code should never be reached because this should be fixed in
|
// This code should never be reached because this should be fixed in
|
||||||
// map function
|
// map function
|
||||||
resourceRegistryPublisher.addResourceToCurrentContext(r);
|
resourceRegistryPublisher.addResourceToCurrentContext(r);
|
||||||
|
|
|
@ -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.properties.Header;
|
||||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||||
import org.gcube.informationsystem.model.reference.relations.IsIdentifiedBy;
|
import org.gcube.informationsystem.model.reference.relations.IsIdentifiedBy;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceAvailableInAnotherContextException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
|
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.SimpleFacetImpl;
|
||||||
import org.gcube.resourcemanagement.model.impl.entities.facets.SoftwareFacetImpl;
|
import org.gcube.resourcemanagement.model.impl.entities.facets.SoftwareFacetImpl;
|
||||||
import org.gcube.resourcemanagement.model.impl.entities.resources.ConfigurationImpl;
|
import org.gcube.resourcemanagement.model.impl.entities.resources.ConfigurationImpl;
|
||||||
|
@ -45,15 +45,14 @@ public class GenericResourceExporter extends GCoreResourceMapper<GenericResource
|
||||||
|
|
||||||
try {
|
try {
|
||||||
readFromIS = resourceRegistryClient.exists(rClass, uuid);
|
readFromIS = resourceRegistryClient.exists(rClass, uuid);
|
||||||
}catch (NotFoundException e) {
|
} catch(ResourceNotFoundException e) {
|
||||||
readFromIS = false;
|
readFromIS = false;
|
||||||
} catch (AvailableInAnotherContextException e) {
|
} catch(ResourceAvailableInAnotherContextException e) {
|
||||||
resourceRegistryPublisher.addResourceToCurrentContext(Configuration.NAME, uuid);
|
resourceRegistryPublisher.addResourceToCurrentContext(Configuration.NAME, uuid);
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
readFromIS = true;
|
readFromIS = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(readFromIS) {
|
if(readFromIS) {
|
||||||
configuration = read(uuid);
|
configuration = read(uuid);
|
||||||
//softwareFacet = (SoftwareFacet) configuration.getIdentificationFacets().get(0);
|
//softwareFacet = (SoftwareFacet) configuration.getIdentificationFacets().get(0);
|
||||||
|
@ -86,12 +85,11 @@ public class GenericResourceExporter extends GCoreResourceMapper<GenericResource
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
if(softwareFacet == null) {
|
if(softwareFacet == null) {
|
||||||
softwareFacet = new SoftwareFacetImpl();
|
softwareFacet = new SoftwareFacetImpl();
|
||||||
IsIdentifiedBy<Configuration, SoftwareFacet> identifiedBy =
|
IsIdentifiedBy<Configuration,SoftwareFacet> identifiedBy = new IsIdentifiedByImpl<Configuration,SoftwareFacet>(
|
||||||
new IsIdentifiedByImpl<Configuration, SoftwareFacet>(configuration, softwareFacet, null);
|
configuration, softwareFacet, null);
|
||||||
configuration.addFacet(identifiedBy);
|
configuration.addFacet(identifiedBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
softwareFacet.setGroup(profile.type());
|
softwareFacet.setGroup(profile.type());
|
||||||
softwareFacet.setName(profile.name());
|
softwareFacet.setName(profile.name());
|
||||||
softwareFacet.setVersion(FIXED_VERSION);
|
softwareFacet.setVersion(FIXED_VERSION);
|
||||||
|
|
|
@ -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.properties.Header;
|
||||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||||
import org.gcube.informationsystem.model.reference.relations.IsIdentifiedBy;
|
import org.gcube.informationsystem.model.reference.relations.IsIdentifiedBy;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceAvailableInAnotherContextException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException;
|
||||||
import org.gcube.informationsystem.utils.ISMapper;
|
import org.gcube.informationsystem.utils.ISMapper;
|
||||||
import org.gcube.resourcemanagement.model.impl.entities.facets.AccessPointFacetImpl;
|
import org.gcube.resourcemanagement.model.impl.entities.facets.AccessPointFacetImpl;
|
||||||
import org.gcube.resourcemanagement.model.impl.entities.facets.NetworkingFacetImpl;
|
import org.gcube.resourcemanagement.model.impl.entities.facets.NetworkingFacetImpl;
|
||||||
|
@ -81,9 +81,9 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
|
||||||
|
|
||||||
try {
|
try {
|
||||||
readFromIS = resourceRegistryClient.exists(rClass, uuid);
|
readFromIS = resourceRegistryClient.exists(rClass, uuid);
|
||||||
}catch (NotFoundException e) {
|
} catch(ResourceNotFoundException e) {
|
||||||
readFromIS = false;
|
readFromIS = false;
|
||||||
}catch (AvailableInAnotherContextException e) {
|
} catch(ResourceAvailableInAnotherContextException e) {
|
||||||
resourceRegistryPublisher.addResourceToCurrentContext(EService.NAME, uuid);
|
resourceRegistryPublisher.addResourceToCurrentContext(EService.NAME, uuid);
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
readFromIS = true;
|
readFromIS = true;
|
||||||
|
@ -150,8 +150,8 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
if(softwareFacet == null) {
|
if(softwareFacet == null) {
|
||||||
softwareFacet = new SoftwareFacetImpl();
|
softwareFacet = new SoftwareFacetImpl();
|
||||||
IsIdentifiedBy<EService, SoftwareFacet> identifiedBy =
|
IsIdentifiedBy<EService,SoftwareFacet> identifiedBy = new IsIdentifiedByImpl<EService,SoftwareFacet>(
|
||||||
new IsIdentifiedByImpl<EService, SoftwareFacet>(eService, softwareFacet, null);
|
eService, softwareFacet, null);
|
||||||
eService.addFacet(identifiedBy);
|
eService.addFacet(identifiedBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,6 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
|
||||||
}
|
}
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
Platform platform = profile.platform();
|
Platform platform = profile.platform();
|
||||||
|
|
||||||
|
@ -175,13 +174,11 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
|
||||||
|
|
||||||
platformSoftwareFacet.setGroup(PLATFORM);
|
platformSoftwareFacet.setGroup(PLATFORM);
|
||||||
platformSoftwareFacet.setName(platform.name());
|
platformSoftwareFacet.setName(platform.name());
|
||||||
String platformVersion = String.format("%d.%d.%d-%d",
|
String platformVersion = String.format("%d.%d.%d-%d", platform.version(), platform.minorVersion(),
|
||||||
platform.version(), platform.minorVersion(),
|
|
||||||
platform.revisionVersion(), platform.buildVersion());
|
platform.revisionVersion(), platform.buildVersion());
|
||||||
softwareFacet.setVersion(platformVersion);
|
softwareFacet.setVersion(platformVersion);
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
Runtime runTime = profile.runtime();
|
Runtime runTime = profile.runtime();
|
||||||
|
|
||||||
|
@ -203,13 +200,13 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
|
||||||
|
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(AccessPoint accessPoint : accessPoints) {
|
for(AccessPoint accessPoint : accessPoints) {
|
||||||
if(accessPointFacets[i] == null) {
|
if(accessPointFacets[i] == null) {
|
||||||
accessPointFacets[i] = new AccessPointFacetImpl();
|
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);
|
consistsOf.setAdditionalProperty(POSITION, i);
|
||||||
eService.addFacet(consistsOf);
|
eService.addFacet(consistsOf);
|
||||||
}
|
}
|
||||||
|
@ -243,7 +240,6 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
|
||||||
}
|
}
|
||||||
/* END Managing Username and Password */
|
/* END Managing Username and Password */
|
||||||
|
|
||||||
|
|
||||||
/* Managing AccessPoint Properties */
|
/* Managing AccessPoint Properties */
|
||||||
Group<Property> properties = accessPoint.properties();
|
Group<Property> properties = accessPoint.properties();
|
||||||
if(properties != null && properties.size() > 0) {
|
if(properties != null && properties.size() > 0) {
|
||||||
|
@ -277,7 +273,6 @@ public class ServiceEndpointExporter extends GCoreResourceMapper<ServiceEndpoint
|
||||||
}
|
}
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
return eService;
|
return eService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue