1 /*******************************************************************************
2 * Copyright (c) 2009 Ordina and committers to Mod4j
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Ordina - initial implementation
10 *******************************************************************************/
11 package org.mod4j.dslcommon.openarchitectureware;
12
13 import org.mod4j.crossx.broker.CrossxEnvironment;
14 import org.mod4j.crossx.mm.crossx.ModelInfo;
15 import org.eclipse.emf.mwe.core.WorkflowContext;
16 import org.eclipse.emf.mwe.core.issues.Issues;
17 import org.eclipse.emf.mwe.core.lib.WorkflowComponentWithModelSlot;
18
19 import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
20
21 /*
22 * Workflow component to write a Crossx model to an XML file.
23 * Referenced from workflow (*.oaw) files.
24 */
25 public class CrossxWorkflowComponent extends WorkflowComponentWithModelSlot {
26
27 /**
28 * Converts a ModelInfo into an XML structure and writes this to file.
29 *
30 * Then calling MyWorkflowComponent the invoke method is called. We use it, to instance the model and apply it to a
31 * modelslot, so it can be used later by the generator component.
32 *
33 * @see org.openarchitectureware.workflow.WorkflowComponent#invoke(org.openarchitectureware.workflow.WorkflowContext,
34 * org.openarchitectureware.workflow.monitor.ProgressMonitor, org.openarchitectureware.workflow.issues.Issues)
35 */
36 @Override
37 public void invokeInternal(WorkflowContext wfCxt, ProgressMonitor arg1, Issues arg2) {
38
39 Object model = wfCxt.get(getModelSlot());
40
41 ModelInfo modelInfo = (ModelInfo) model;
42
43 CrossxEnvironment.addModelInfo(getProject(), modelInfo);
44 }
45
46 // Capture the value of the <outputFile> slot in the workflow
47 public String outputFile;
48
49 protected String getOutputFile() {
50 return outputFile;
51 }
52
53 public void setOutputFile(final String outlet) {
54 this.outputFile = outlet;
55 }
56
57 // capture the value of the <outputFile> slot in the workflow
58 public String project;
59
60 protected String getProject() {
61 return project;
62 }
63
64 public void setProject(final String theProject) {
65 this.project = theProject;
66 }
67
68 }