Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferdinando Villa committed Nov 7, 2024
1 parent 89ddb06 commit 6a389c7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,9 @@ public boolean isReceiver() {
return receiver;
}

private class MessageFuture<T> implements Future<T> {
private static class MessageFuture<T> implements Future<T> {

private AtomicReference<T> payload = null;
private AtomicReference<T> payload = new AtomicReference<>();
private AtomicBoolean resolved = new AtomicBoolean(false);
private boolean cancelled;
private final Message.Match match;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,31 +107,11 @@ public void initializeService() {
serviceScope().send(Message.MessageClass.ServiceLifecycle, Message.MessageType.ServiceInitializing,
capabilities(serviceScope()).toString());

/*
* Components
*/
Set<String> extensionPackages = new LinkedHashSet<>();
// extensionPackages.add("org.integratedmodelling.klab.runtime");
// extensionPackages.add("org.integratedmodelling.klab.runtime.temporary");

if (createMainKnowledgeGraph()) {

/*
* Check for updates, load and scan all new plug-ins, returning the main packages to scan
* FIXME update, put in BaseService
*/
// extensionPackages.addAll(Configuration.INSTANCE.updateAndLoadComponents("resolver"));

// TODO internal libraries
getComponentRegistry().loadExtensions("org.integratedmodelling.klab.runtime");
getComponentRegistry().initializeComponents(BaseService.getConfigurationSubdirectory(startupOptions, "components"));

// for (String pack : extensionPackages) {
// ServiceConfiguration.INSTANCE.scanPackage(pack, Maps.of(
// Library.class,
// ServiceConfiguration.INSTANCE.LIBRARY_LOADER));
// }

serviceScope().send(Message.MessageClass.ServiceLifecycle, Message.MessageType.ServiceAvailable
, capabilities(serviceScope()));
} else {
Expand Down Expand Up @@ -174,10 +154,6 @@ public Capabilities capabilities(Scope scope) {
ret.setServiceId(configuration.getServiceId());
ret.setServiceName("Runtime");
ret.setBrokerURI(embeddedBroker != null ? embeddedBroker.getURI() : configuration.getBrokerURI());
// ret.setAvailableMessagingQueues(Utils.URLs.isLocalHost(getUrl()) ?
// EnumSet.of(Message.Queue.Info, Message.Queue.Errors,
// Message.Queue.Warnings) :
// EnumSet.noneOf(Message.Queue.class));
ret.setBrokerURI(embeddedBroker != null ? embeddedBroker.getURI() : configuration.getBrokerURI());

return ret;
Expand All @@ -192,25 +168,6 @@ public Map<String, String> getExceptionTestcases(Scope scope, boolean deleteExis
Map<String, String> ret = new HashMap<>();
return ret;
}
//
// /**
// * Ensure that we have the runtime support for the passed service call. If we need a component to
// serve
// * it, check that the scope has access to it and load it if necessary as a background process.
// Return all
// * the relevant notifications which will be passed to clients. If one or more error notifications
// are
// * return, the service call is invalid and any dataflow it is part of is in error.
// *
// * @param call
// * @param scope
// * @return any notifications. Empty mean "all OK for execution".
// */
// public Collection<Notification> validateServiceCall(ServiceCall call, Scope scope) {
// List<Notification> ret = new ArrayList<>();
// // TODO
// return ret;
// }

@Override
public String registerSession(SessionScope sessionScope) {
Expand Down Expand Up @@ -405,33 +362,6 @@ private DigitalTwin getDigitalTwin(ContextScope contextScope) {
"implementation");
}

// private void run(Actuator rootActuator, ContextScope scope, DigitalTwin digitalTwin) {
//
//
// /*
// Turn the actuator hierarchy into a flat list in dependency order. Both actuator containment and
// reference count as
// dependencies between observations.
// */
// ExecutionSequence currentContext = executionSequence;
// for (Actuator actuator : computeActuatorOrder(rootActuator, scope)) {
//
// currentContext = currentContext.runActuator(actuator);
//
// if (currentContext.isEmpty()) {
// scope.error(currentContext.statusLine(), currentContext.errorCode(),
// currentContext.errorContext(), currentContext.statusInfo());
// break;
// }
//
// /*
// Observation was computed: submit the actuator and its provenance info to the digital twin
// */
//
// }
//
// }

private Graph<Actuator, DefaultEdge> computeActuatorOrder(Actuator rootActuator, ContextScope scope) {
Graph<Actuator, DefaultEdge> dependencyGraph = new DefaultDirectedGraph<>(DefaultEdge.class);
Map<Long, Actuator> cache = new HashMap<>();
Expand Down Expand Up @@ -507,7 +437,6 @@ public List<SessionInfo> getSessionInfo(Scope scope) {
return knowledgeGraph.getSessionInfo(scope);
}


/**
* Establish the order of execution and the possible parallelism. Each root actuator should be sorted by
* dependency and appended in order to the result list along with its order of execution. Successive roots
Expand Down

0 comments on commit 6a389c7

Please sign in to comment.