From 041d60f64b902ebc33f9ec817096dc913233eecd Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Mon, 20 Sep 2010 10:09:01 +0000 Subject: [PATCH] Adapt SlcExecution for RCP git-svn-id: https://svn.argeo.org/slc/trunk@3777 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../META-INF/MANIFEST.MF | 3 + .../META-INF/spring/rcp-osgi.xml | 5 ++ .../META-INF/spring/rcp.xml | 5 ++ .../META-INF/MANIFEST.MF | 7 ++- .../META-INF/spring/controllers.xml | 10 ++++ .../META-INF/spring/osgi.xml | 3 +- .../META-INF/spring/views.xml | 11 +--- .../ui/controllers/ProcessController.java | 19 ++++++ .../client/ui/views/ExecutionModulesView.java | 13 +++- .../META-INF/spring/agent.xml | 8 +++ .../META-INF/spring/osgi.xml | 5 ++ .../impl/SlcExecutionServiceAdapter.java | 60 +++++++++++++++++++ .../slc/process/SlcExecutionNotifier.java | 2 + 13 files changed, 135 insertions(+), 16 deletions(-) create mode 100644 eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/controllers.xml create mode 100644 eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/controllers/ProcessController.java create mode 100644 runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/services/impl/SlcExecutionServiceAdapter.java diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/META-INF/MANIFEST.MF b/eclipse/plugins/org.argeo.slc.client.rcp/META-INF/MANIFEST.MF index 143e53ea7..bba972f65 100644 --- a/eclipse/plugins/org.argeo.slc.client.rcp/META-INF/MANIFEST.MF +++ b/eclipse/plugins/org.argeo.slc.client.rcp/META-INF/MANIFEST.MF @@ -10,5 +10,8 @@ Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: J2SE-1.5 Import-Package: org.argeo.slc.client.ui.views, org.argeo.slc.core.test.tree;version="0.13.0.SNAPSHOT-r3768", + org.argeo.slc.execution;version="0.13.0.SNAPSHOT-r3770", + org.argeo.slc.process;version="0.13.0.SNAPSHOT-r3770", + org.argeo.slc.runtime;version="0.13.0.SNAPSHOT-r3770", org.argeo.slc.services;version="0.13.0.SNAPSHOT-r3753", org.argeo.slc.services.impl;version="0.13.0.SNAPSHOT-r3753" diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/META-INF/spring/rcp-osgi.xml b/eclipse/plugins/org.argeo.slc.client.rcp/META-INF/spring/rcp-osgi.xml index 1cc8114a7..b171bae91 100644 --- a/eclipse/plugins/org.argeo.slc.client.rcp/META-INF/spring/rcp-osgi.xml +++ b/eclipse/plugins/org.argeo.slc.client.rcp/META-INF/spring/rcp-osgi.xml @@ -7,9 +7,14 @@ http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> + + + + + + + + + diff --git a/eclipse/plugins/org.argeo.slc.client.ui/META-INF/MANIFEST.MF b/eclipse/plugins/org.argeo.slc.client.ui/META-INF/MANIFEST.MF index aaba9d93e..e49d35e8f 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/META-INF/MANIFEST.MF +++ b/eclipse/plugins/org.argeo.slc.client.ui/META-INF/MANIFEST.MF @@ -24,8 +24,9 @@ Import-Package: org.apache.commons.logging;version="1.1.1", org.argeo.slc.execution;version="0.13.0.SNAPSHOT-r3685", org.argeo.slc.process;version="0.13.0.SNAPSHOT-r3685", org.argeo.slc.runtime;version="0.13.0.SNAPSHOT-r3685", + org.argeo.slc.services;version="0.13.0.SNAPSHOT-r3773", + org.hibernate.hql.ast, + org.hibernate.jdbc, org.springframework.beans.factory, org.springframework.context, - org.springframework.core.io.support, - org.hibernate.jdbc, - org.hibernate.hql.ast + org.springframework.core.io.support diff --git a/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/controllers.xml b/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/controllers.xml new file mode 100644 index 000000000..62154375e --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/controllers.xml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/osgi.xml b/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/osgi.xml index be57f3900..ae273ad9b 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/osgi.xml +++ b/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/osgi.xml @@ -10,6 +10,5 @@ interface="org.argeo.slc.execution.ExecutionModulesManager" /> - - + \ No newline at end of file diff --git a/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/views.xml b/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/views.xml index f21f2d8c0..7019d7591 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/views.xml +++ b/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/views.xml @@ -7,6 +7,7 @@ + - - - - - - - - - + diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/controllers/ProcessController.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/controllers/ProcessController.java new file mode 100644 index 000000000..5785305ab --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/controllers/ProcessController.java @@ -0,0 +1,19 @@ +package org.argeo.slc.client.ui.controllers; + +import org.argeo.slc.process.SlcExecution; +import org.argeo.slc.runtime.SlcAgent; +import org.argeo.slc.services.SlcExecutionService; + +public class ProcessController { + private SlcExecutionService slcExecutionService; + + public void execute(SlcAgent agent, SlcExecution slcExecution) { + slcExecutionService.newExecution(slcExecution); + agent.runSlcExecution(slcExecution); + } + + public void setSlcExecutionService(SlcExecutionService slcExecutionService) { + this.slcExecutionService = slcExecutionService; + } + +} diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesView.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesView.java index ec7607050..a4d040314 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesView.java +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesView.java @@ -2,8 +2,10 @@ package org.argeo.slc.client.ui.views; import java.util.ArrayList; import java.util.List; +import java.util.UUID; import org.argeo.slc.client.ui.ClientUiPlugin; +import org.argeo.slc.client.ui.controllers.ProcessController; import org.argeo.slc.execution.ExecutionModuleDescriptor; import org.argeo.slc.process.RealizedFlow; import org.argeo.slc.process.SlcExecution; @@ -28,6 +30,8 @@ public class ExecutionModulesView extends ViewPart { private IContentProvider contentProvider; + private ProcessController processController; + class ViewLabelProvider extends LabelProvider implements ITableLabelProvider { public String getColumnText(Object obj, int index) { @@ -89,9 +93,10 @@ public class ExecutionModulesView extends ViewPart { realizedFlows.add(realizedFlow); SlcExecution slcExecution = new SlcExecution(); + slcExecution.setUuid(UUID.randomUUID().toString()); slcExecution.setRealizedFlows(realizedFlows); - fn.getExecutionModuleNode().getAgentNode().getAgent() - .runSlcExecution(slcExecution); + processController.execute(fn.getExecutionModuleNode() + .getAgentNode().getAgent(), slcExecution); } } }); @@ -112,4 +117,8 @@ public class ExecutionModulesView extends ViewPart { this.contentProvider = contentProvider; } + public void setProcessController(ProcessController processController) { + this.processController = processController; + } + } \ No newline at end of file diff --git a/modules/agent/org.argeo.slc.agent/META-INF/spring/agent.xml b/modules/agent/org.argeo.slc.agent/META-INF/spring/agent.xml index 1ec088763..b412297ab 100644 --- a/modules/agent/org.argeo.slc.agent/META-INF/spring/agent.xml +++ b/modules/agent/org.argeo.slc.agent/META-INF/spring/agent.xml @@ -23,5 +23,13 @@ + + + + + + + + \ No newline at end of file diff --git a/modules/agent/org.argeo.slc.agent/META-INF/spring/osgi.xml b/modules/agent/org.argeo.slc.agent/META-INF/spring/osgi.xml index f5e36ca97..94b81c2a8 100644 --- a/modules/agent/org.argeo.slc.agent/META-INF/spring/osgi.xml +++ b/modules/agent/org.argeo.slc.agent/META-INF/spring/osgi.xml @@ -20,4 +20,9 @@ + + + + + \ No newline at end of file diff --git a/runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/services/impl/SlcExecutionServiceAdapter.java b/runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/services/impl/SlcExecutionServiceAdapter.java new file mode 100644 index 000000000..a007e6ce5 --- /dev/null +++ b/runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/services/impl/SlcExecutionServiceAdapter.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2010 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.argeo.slc.services.impl; + +import java.util.List; + +import org.argeo.slc.UnsupportedException; +import org.argeo.slc.msg.process.SlcExecutionStatusRequest; +import org.argeo.slc.msg.process.SlcExecutionStepsRequest; +import org.argeo.slc.process.SlcExecution; +import org.argeo.slc.process.SlcExecutionNotifier; +import org.argeo.slc.process.SlcExecutionStep; +import org.argeo.slc.services.SlcExecutionService; + +/** In memory bridge between SLC execution notifier and service. */ +public class SlcExecutionServiceAdapter implements SlcExecutionNotifier { + private SlcExecutionService slcExecutionService; + + public void updateStatus(SlcExecution slcExecution, String oldStatus, + String newStatus) { + SlcExecutionStatusRequest req = new SlcExecutionStatusRequest( + slcExecution.getUuid(), newStatus); + slcExecutionService.updateStatus(req); + } + + public void addSteps(SlcExecution slcExecution, + List additionalSteps) { + SlcExecutionStepsRequest req = new SlcExecutionStepsRequest( + slcExecution.getUuid(), additionalSteps); + slcExecutionService.addSteps(req); + } + + public void newExecution(SlcExecution slcExecution) { + throw new UnsupportedException(); + //slcExecutionService.newExecution(slcExecution); + } + + public void updateExecution(SlcExecution slcExecution) { + throw new UnsupportedException(); + } + + public void setSlcExecutionService(SlcExecutionService slcExecutionService) { + this.slcExecutionService = slcExecutionService; + } + +} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecutionNotifier.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecutionNotifier.java index dcf9de6d9..ca6809680 100644 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecutionNotifier.java +++ b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecutionNotifier.java @@ -19,11 +19,13 @@ package org.argeo.slc.process; import java.util.List; public interface SlcExecutionNotifier { + @Deprecated public void newExecution(SlcExecution slcExecution); public void addSteps(SlcExecution slcExecution, List additionalSteps); + @Deprecated public void updateExecution(SlcExecution slcExecution); public void updateStatus(SlcExecution slcExecution, String oldStatus, -- 2.39.2