Fixed handlers
This commit is contained in:
parent
16da31d117
commit
ada756fb04
|
@ -236,11 +236,15 @@ public class EServiceHandler extends ApplicationLifecycleHandler {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// periodicUpdates = Utils.scheduledServicePool.scheduleAtFixedRate(updateTask,
|
periodicUpdates = Utils.scheduledServicePool.scheduleAtFixedRate(updateTask,
|
||||||
// Constants.application_republish_frequency_in_minutes,
|
Constants.application_republish_frequency_in_minutes,
|
||||||
// Constants.application_republish_frequency_in_minutes, TimeUnit.MINUTES);
|
Constants.application_republish_frequency_in_minutes, TimeUnit.MINUTES);
|
||||||
|
|
||||||
periodicUpdates = Utils.scheduledServicePool.scheduleAtFixedRate(updateTask, 120, 120, TimeUnit.SECONDS);
|
/*
|
||||||
|
* The following line is used for testing purposes during development.
|
||||||
|
* If you uncomment this, you need to comment the line above
|
||||||
|
*/
|
||||||
|
// periodicUpdates = Utils.scheduledServicePool.scheduleAtFixedRate(updateTask, 120, 120, TimeUnit.SECONDS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClien
|
||||||
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;
|
||||||
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisherFactory;
|
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisherFactory;
|
||||||
|
import org.gcube.informationsystem.utils.ElementMapper;
|
||||||
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.EventFacetImpl;
|
import org.gcube.resourcemanagement.model.impl.entities.facets.EventFacetImpl;
|
||||||
import org.gcube.resourcemanagement.model.impl.entities.facets.SoftwareFacetImpl;
|
import org.gcube.resourcemanagement.model.impl.entities.facets.SoftwareFacetImpl;
|
||||||
|
@ -280,7 +281,7 @@ public class EServiceManager {
|
||||||
updateFacets();
|
updateFacets();
|
||||||
} catch (NotFoundException e) {
|
} catch (NotFoundException e) {
|
||||||
eService = instantiateEService();
|
eService = instantiateEService();
|
||||||
createActivatesRelation(eService);
|
eService = createActivatesRelation(eService).getTarget();
|
||||||
} catch (AvailableInAnotherContextException e) {
|
} catch (AvailableInAnotherContextException e) {
|
||||||
addHostingNodeToCurrentContext();
|
addHostingNodeToCurrentContext();
|
||||||
try {
|
try {
|
||||||
|
@ -292,7 +293,7 @@ public class EServiceManager {
|
||||||
// If the EService is still not available we need to create activates
|
// If the EService is still not available we need to create activates
|
||||||
// relation because does not exists otherwise the EService should
|
// relation because does not exists otherwise the EService should
|
||||||
// already be in the context due to propagation constraint.
|
// already be in the context due to propagation constraint.
|
||||||
createActivatesRelation(eService);
|
eService = createActivatesRelation(eService).getTarget();
|
||||||
}
|
}
|
||||||
updateFacets();
|
updateFacets();
|
||||||
} catch (ResourceRegistryException e) {
|
} catch (ResourceRegistryException e) {
|
||||||
|
@ -347,10 +348,16 @@ public class EServiceManager {
|
||||||
eService.addFacet(eventFacet);
|
eService.addFacet(eventFacet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
logger.trace("Updating {} for {} : {}", EService.NAME, applicationContext.configuration().name(), ElementMapper.marshal(eService));
|
||||||
|
}catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
eService = resourceRegistryPublisher.updateResource(eService);
|
eService = resourceRegistryPublisher.updateResource(eService);
|
||||||
}catch (ResourceRegistryException e) {
|
}catch (ResourceRegistryException e) {
|
||||||
logger.error("error trying to publish hosting node", e);
|
logger.error("Error trying to publish hosting node", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return eService;
|
return eService;
|
||||||
|
@ -366,6 +373,12 @@ public class EServiceManager {
|
||||||
propagationConstraint.setAddConstraint(AddConstraint.propagate);
|
propagationConstraint.setAddConstraint(AddConstraint.propagate);
|
||||||
Activates<HostingNode, EService> activates = new ActivatesImpl<>(hostingNode, eService, propagationConstraint);
|
Activates<HostingNode, EService> activates = new ActivatesImpl<>(hostingNode, eService, propagationConstraint);
|
||||||
|
|
||||||
|
try {
|
||||||
|
logger.trace("Going to create {} and {} for application {} : {}", Activates.NAME, EService.NAME, applicationContext.configuration().name(), ElementMapper.marshal(activates));
|
||||||
|
}catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
activates = resourceRegistryPublisher.createIsRelatedTo(activates);
|
activates = resourceRegistryPublisher.createIsRelatedTo(activates);
|
||||||
hostingNode.attachResource(activates);
|
hostingNode.attachResource(activates);
|
||||||
|
|
Loading…
Reference in New Issue