diff --git a/src/org/gcube/informationsystem/collector/impl/state/AggregatorRegisteredResource.java b/src/org/gcube/informationsystem/collector/impl/state/AggregatorRegisteredResource.java index f8a5956..be7cabd 100755 --- a/src/org/gcube/informationsystem/collector/impl/state/AggregatorRegisteredResource.java +++ b/src/org/gcube/informationsystem/collector/impl/state/AggregatorRegisteredResource.java @@ -161,12 +161,6 @@ public class AggregatorRegisteredResource extends AggregatorServiceGroupResource logger.info("New delivered resource"); try { - - /* - * logger.debug(State.logPrefix + "delivered message -> " + - * AnyHelper.toSingleString(messageObj)); - */ - // get the message content MsgParser aentry = new MsgParser(messageObj); String entryType = aentry.getEntryType(); @@ -174,13 +168,7 @@ public class AggregatorRegisteredResource extends AggregatorServiceGroupResource logger.debug("Entry RunningInstance ID " + aentry.getRunningInstanceID()); logger.debug("Entry Service Name " + aentry.getServiceName()); logger.debug("Entry Service Class " + aentry.getServiceClass()); - - - // logger.debug(State.logPrefix + "getEntryAsString " + - // aentry.getEntryAsString()); - - // MessageElement[] message = messageObj.get_any(); - + // extract the entry EPR EntryParser entryparser = new EntryParser(entry); EntryEPRParser sinkparser = entryparser.getEPRSinkParser(); @@ -190,6 +178,9 @@ public class AggregatorRegisteredResource extends AggregatorServiceGroupResource // Build the new resource to store logger.debug("Storing the new delivered resource"); + + //TODO: check if it's a profile or an RP, by relying on the publisher (registry or not) + GCUBEInstanceStateResource instanceState = new GCUBEInstanceStateResource(); instanceState.setResourceName(Identifier.buildInstanceStateID(entryparser)); instanceState.setContent(aentry.getEntryAsString()); diff --git a/src/org/gcube/informationsystem/collector/impl/xmlstorage/exist/State.java b/src/org/gcube/informationsystem/collector/impl/xmlstorage/exist/State.java index bc03f58..01ac71e 100755 --- a/src/org/gcube/informationsystem/collector/impl/xmlstorage/exist/State.java +++ b/src/org/gcube/informationsystem/collector/impl/xmlstorage/exist/State.java @@ -70,6 +70,7 @@ public class State { Sweeper sweeper = new Sweeper(Long.valueOf((String) ICServiceContext.getContext().getProperty("sweeperIntervalInMillis", true)), Long.valueOf((String) ICServiceContext.getContext().getProperty("resourceExpirationTimeInMillis", true))); State.sweeperT = new Thread(sweeper); + State.sweeperT.setName("ICSweeper"); State.sweeperT.start(); } @@ -80,6 +81,7 @@ public class State { if (scheduler != null) { if (State.schedulerT == null) State.schedulerT = new Thread(scheduler); + State.schedulerT.setName("BackupScheduler"); State.schedulerT.start(); } logger.info("IC service initialization completed"); diff --git a/src/org/gcube/informationsystem/collector/impl/xmlstorage/exist/Sweeper.java b/src/org/gcube/informationsystem/collector/impl/xmlstorage/exist/Sweeper.java index 3f5c5eb..0b85421 100755 --- a/src/org/gcube/informationsystem/collector/impl/xmlstorage/exist/Sweeper.java +++ b/src/org/gcube/informationsystem/collector/impl/xmlstorage/exist/Sweeper.java @@ -83,10 +83,15 @@ public class Sweeper implements Runnable { GCUBEInstanceStateResource tempresource = new GCUBEInstanceStateResource(); tempresource.setResourceName(id); GCUBEXMLResource xmlresource = new GCUBEXMLResource(tempresource); - State.getDataManager().retrieveResourceContent(new GCUBEXMLResource(tempresource)); - if (now.getTimeInMillis() - xmlresource.getLastUpdateTimeinMills() > Sweeper.resourceExpirationTime) + State.getDataManager().retrieveResourceContent(xmlresource); + logger.trace("Checking resource " + id); + logger.trace("Now is " + now.getTimeInMillis()); + logger.trace("Resource expires at " + xmlresource.getTerminationTime().getTimeInMillis()); + if (now.getTimeInMillis() > xmlresource.getTerminationTime().getTimeInMillis()) { // removes the resources from the database State.getDataManager().deleteResource(xmlresource); + logger.info("Resource " + xmlresource.getResourceName() + " deleted"); + } // break; } catch (Exception e) { logger.debug("IC sweeper - the resource " + id + " is no longer available in the storage"); diff --git a/src/org/gcube/informationsystem/collector/stubs/testsuite/wsdaix/AddDocumentsTester.java b/src/org/gcube/informationsystem/collector/stubs/testsuite/wsdaix/AddDocumentsTester.java index 9ada4f0..b2b50aa 100644 --- a/src/org/gcube/informationsystem/collector/stubs/testsuite/wsdaix/AddDocumentsTester.java +++ b/src/org/gcube/informationsystem/collector/stubs/testsuite/wsdaix/AddDocumentsTester.java @@ -17,7 +17,6 @@ import org.gcube.informationsystem.collector.stubs.wsdai.InvalidResourceNameFaul import org.gcube.informationsystem.collector.stubs.wsdai.NotAuthorizedFaultType; import org.gcube.informationsystem.collector.stubs.wsdai.ServiceBusyFaultType; import org.gcube.informationsystem.collector.stubs.wsdaix.AddDocumentRequestWrapper; -import org.gcube.informationsystem.collector.stubs.wsdaix.AddDocumentResponseWrapperResponse; import org.gcube.informationsystem.collector.stubs.wsdaix.AddDocumentsRequest; import org.gcube.informationsystem.collector.stubs.wsdaix.AddDocumentsResponse; import org.gcube.informationsystem.collector.stubs.wsdaix.InvalidCollectionNameFaultType; diff --git a/src/org/gcube/informationsystem/collector/stubs/testsuite/wsdaix/GetDocumentsTester.java b/src/org/gcube/informationsystem/collector/stubs/testsuite/wsdaix/GetDocumentsTester.java index cbab6c7..a9bc80e 100644 --- a/src/org/gcube/informationsystem/collector/stubs/testsuite/wsdaix/GetDocumentsTester.java +++ b/src/org/gcube/informationsystem/collector/stubs/testsuite/wsdaix/GetDocumentsTester.java @@ -22,7 +22,6 @@ import org.gcube.informationsystem.collector.stubs.wsdai.NotAuthorizedFaultType; import org.gcube.informationsystem.collector.stubs.wsdai.ServiceBusyFaultType; import org.gcube.informationsystem.collector.stubs.wsdaix.GetDocumentRequestWrapper; import org.gcube.informationsystem.collector.stubs.wsdaix.GetDocumentResponseWrapper; -import org.gcube.informationsystem.collector.stubs.wsdaix.GetDocumentResponseWrapperResponse; import org.gcube.informationsystem.collector.stubs.wsdaix.GetDocumentsRequest; import org.gcube.informationsystem.collector.stubs.wsdaix.GetDocumentsResponse; import org.gcube.informationsystem.collector.stubs.wsdaix.InvalidCollectionNameFaultType;