|
a/src/main/java/net/timbusproject/extractors/modules/tavernaextractor/TavernaExtractor.java |
|
b/src/main/java/net/timbusproject/extractors/modules/tavernaextractor/TavernaExtractor.java |
|
... |
|
... |
27 |
import net.sf.taverna.t2.activities.beanshell.BeanshellActivity;
|
27 |
import net.sf.taverna.t2.activities.beanshell.BeanshellActivity;
|
28 |
import net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean;
|
28 |
import net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean;
|
29 |
import net.sf.taverna.t2.activities.dataflow.DataflowActivity;
|
29 |
import net.sf.taverna.t2.activities.dataflow.DataflowActivity;
|
30 |
import net.sf.taverna.t2.activities.externaltool.ExternalToolActivity;
|
30 |
import net.sf.taverna.t2.activities.externaltool.ExternalToolActivity;
|
31 |
import net.sf.taverna.t2.activities.externaltool.ExternalToolActivityConfigurationBean;
|
31 |
import net.sf.taverna.t2.activities.externaltool.ExternalToolActivityConfigurationBean;
|
|
|
32 |
import net.sf.taverna.t2.activities.localworker.LocalworkerActivity;
|
32 |
import net.sf.taverna.t2.activities.rest.RESTActivity;
|
33 |
import net.sf.taverna.t2.activities.rest.RESTActivity;
|
33 |
import net.sf.taverna.t2.activities.rshell.RshellActivity;
|
34 |
import net.sf.taverna.t2.activities.rshell.RshellActivity;
|
34 |
import net.sf.taverna.t2.activities.rshell.RshellActivityConfigurationBean;
|
35 |
import net.sf.taverna.t2.activities.rshell.RshellActivityConfigurationBean;
|
35 |
import net.sf.taverna.t2.activities.wsdl.WSDLActivity;
|
36 |
import net.sf.taverna.t2.activities.wsdl.WSDLActivity;
|
36 |
import net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLInputSplitterActivity;
|
37 |
import net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLInputSplitterActivity;
|
37 |
import net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLOutputSplitterActivity;
|
38 |
import net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLOutputSplitterActivity;
|
|
|
39 |
import net.sf.taverna.t2.activities.xpath.XPathActivity;
|
|
|
40 |
import net.sf.taverna.t2.activities.xpath.XPathActivityConfigurationBean;
|
38 |
import net.sf.taverna.t2.commandline.CommandLineLauncher;
|
41 |
import net.sf.taverna.t2.commandline.CommandLineLauncher;
|
39 |
import net.sf.taverna.t2.commandline.exceptions.DatabaseConfigurationException;
|
42 |
import net.sf.taverna.t2.commandline.exceptions.DatabaseConfigurationException;
|
40 |
import net.sf.taverna.t2.commandline.exceptions.InvalidOptionException;
|
43 |
import net.sf.taverna.t2.commandline.exceptions.InvalidOptionException;
|
41 |
import net.sf.taverna.t2.commandline.exceptions.OpenDataflowException;
|
44 |
import net.sf.taverna.t2.commandline.exceptions.OpenDataflowException;
|
42 |
import net.sf.taverna.t2.commandline.exceptions.ReadInputException;
|
45 |
import net.sf.taverna.t2.commandline.exceptions.ReadInputException;
|
|
... |
|
... |
177 |
private IApplicationComponent workflowApplicationComponent = null;
|
180 |
private IApplicationComponent workflowApplicationComponent = null;
|
178 |
private IApplicationFunction callScriptApplicationFunction = null;
|
181 |
private IApplicationFunction callScriptApplicationFunction = null;
|
179 |
private IApplicationFunction callXMLSplitterApplicationFunction = null;
|
182 |
private IApplicationFunction callXMLSplitterApplicationFunction = null;
|
180 |
private IApplicationFunction callWebServiceApplicationFunction = null;
|
183 |
private IApplicationFunction callWebServiceApplicationFunction = null;
|
181 |
private IApplicationFunction callToolInvocationFunction = null;
|
184 |
private IApplicationFunction callToolInvocationFunction = null;
|
|
|
185 |
private IApplicationFunction callXPathApplicationFunction = null;
|
182 |
|
186 |
|
183 |
private Dataflow dataflow;
|
187 |
private Dataflow dataflow;
|
184 |
private SSHManager sshManager;
|
188 |
private SSHManager sshManager;
|
185 |
private static Logger LOGGER = LogManager.getLogger("TavernaExtractor");
|
189 |
private static Logger LOGGER = LogManager.getLogger("TavernaExtractor");
|
186 |
|
190 |
|
|
... |
|
... |
204 |
}
|
208 |
}
|
205 |
|
209 |
|
206 |
/*
|
210 |
/*
|
207 |
* // GETTER & SETTER ///////////////
|
211 |
* // GETTER & SETTER ///////////////
|
208 |
*/
|
212 |
*/
|
209 |
public static void setDotLocation(Path dotLocation) {
|
213 |
public void setDotLocation(Path dotLocation) {
|
210 |
TavernaExtractor.dotLocation = dotLocation;
|
214 |
TavernaExtractor.dotLocation = dotLocation;
|
211 |
}
|
215 |
}
|
212 |
|
216 |
|
213 |
public static Path getDotLocation() {
|
217 |
public Path getDotLocation() {
|
214 |
return dotLocation;
|
218 |
return dotLocation;
|
215 |
}
|
219 |
}
|
216 |
|
220 |
|
217 |
public static Path getArchimateOutputPath() {
|
221 |
public Path getArchimateOutputPath() {
|
218 |
return archimateOutputPath;
|
222 |
return archimateOutputPath;
|
219 |
}
|
223 |
}
|
220 |
|
224 |
|
221 |
public static void setArchimateOutputPath(Path archimateOutputPath) {
|
225 |
public void setArchimateOutputPath(Path archimateOutputPath) {
|
222 |
TavernaExtractor.archimateOutputPath = archimateOutputPath;
|
226 |
TavernaExtractor.archimateOutputPath = archimateOutputPath;
|
223 |
}
|
227 |
}
|
224 |
|
228 |
|
225 |
public static Path getInputFileName() {
|
229 |
public Path getInputFileName() {
|
226 |
return inputFileName;
|
230 |
return inputFileName;
|
227 |
}
|
231 |
}
|
228 |
|
232 |
|
229 |
public static void setInputFileName(Path inputFileName) {
|
233 |
public void setInputFileName(Path inputFileName) {
|
230 |
TavernaExtractor.inputFileName = inputFileName;
|
234 |
TavernaExtractor.inputFileName = inputFileName;
|
231 |
}
|
235 |
}
|
232 |
|
236 |
|
233 |
public static Path getTavernaHome() {
|
237 |
public Path getTavernaHome() {
|
234 |
return tavernaHome;
|
238 |
return tavernaHome;
|
235 |
}
|
239 |
}
|
236 |
|
240 |
|
237 |
public static void setTavernaHome(Path tavernaHome) {
|
241 |
public void setTavernaHome(Path tavernaHome) {
|
238 |
|
242 |
|
239 |
TavernaExtractor.tavernaHome = tavernaHome;
|
243 |
TavernaExtractor.tavernaHome = tavernaHome;
|
240 |
}
|
244 |
}
|
241 |
|
245 |
|
242 |
public static Path getTavernaHomeLib() {
|
246 |
public Path getTavernaHomeLib() {
|
243 |
return tavernaHomeLib;
|
247 |
return tavernaHomeLib;
|
244 |
}
|
248 |
}
|
245 |
|
249 |
|
246 |
public static void setTavernaHomeLib(Path tavernaHomeLib) {
|
250 |
public void setTavernaHomeLib(Path tavernaHomeLib) {
|
247 |
TavernaExtractor.tavernaHomeLib = tavernaHomeLib;
|
251 |
TavernaExtractor.tavernaHomeLib = tavernaHomeLib;
|
248 |
}
|
252 |
}
|
249 |
|
253 |
|
250 |
public static Path getTavernaHomeRepo() {
|
254 |
public Path getTavernaHomeRepo() {
|
251 |
return tavernaHomeRepo;
|
255 |
return tavernaHomeRepo;
|
252 |
}
|
256 |
}
|
253 |
|
257 |
|
254 |
public static void setTavernaHomeRepo(Path tavernaHomeRepo) {
|
258 |
public void setTavernaHomeRepo(Path tavernaHomeRepo) {
|
255 |
TavernaExtractor.tavernaHomeRepo = tavernaHomeRepo;
|
259 |
TavernaExtractor.tavernaHomeRepo = tavernaHomeRepo;
|
256 |
}
|
260 |
}
|
257 |
|
261 |
|
258 |
|
262 |
|
259 |
public List<IRelationship> getRelations() {
|
263 |
public List<IRelationship> getRelations() {
|
|
... |
|
... |
279 |
CMException, IOException, DeserializationException, IterationTypeMismatchException, TavernaExtractorException {
|
283 |
CMException, IOException, DeserializationException, IterationTypeMismatchException, TavernaExtractorException {
|
280 |
|
284 |
|
281 |
LOGGER.info("Start Taverna Extractor ...");
|
285 |
LOGGER.info("Start Taverna Extractor ...");
|
282 |
|
286 |
|
283 |
//setup
|
287 |
//setup
|
284 |
TavernaExtractor.setTavernaHomeLib(TavernaExtractor.getTavernaHome().resolve("lib"));
|
288 |
this.setTavernaHomeLib(this.getTavernaHome().resolve("lib"));
|
285 |
TavernaExtractor.setTavernaHomeRepo(TavernaExtractor.getTavernaHome().resolve("repository"));
|
289 |
this.setTavernaHomeRepo(this.getTavernaHome().resolve("repository"));
|
286 |
|
290 |
|
287 |
if (remote)
|
291 |
if (remote)
|
288 |
validateRemoteDirectories(TavernaExtractor.getTavernaHome(), TavernaExtractor.getTavernaHomeLib(), TavernaExtractor.getTavernaHomeRepo());
|
292 |
validateRemoteDirectories(this.getTavernaHome(), this.getTavernaHomeLib(), this.getTavernaHomeRepo());
|
289 |
else
|
293 |
else
|
290 |
validateDirectories(TavernaExtractor.getTavernaHome(), TavernaExtractor.getTavernaHomeLib(), TavernaExtractor.getTavernaHomeRepo());
|
294 |
validateDirectories(this.getTavernaHome(), this.getTavernaHomeLib(), this.getTavernaHomeRepo());
|
291 |
|
295 |
|
292 |
LOGGER.info("TavernaHome is set to [" + TavernaExtractor.getTavernaHome() + "].");
|
296 |
LOGGER.info("TavernaHome is set to [" + this.getTavernaHome() + "].");
|
293 |
LOGGER.info("TavernaHomeLib is set to [" + TavernaExtractor.getTavernaHomeLib() + "].");
|
297 |
LOGGER.info("TavernaHomeLib is set to [" + this.getTavernaHomeLib() + "].");
|
294 |
LOGGER.info("TavernaHomeRepo is set to [" + TavernaExtractor.getTavernaHomeRepo() + "].");
|
298 |
LOGGER.info("TavernaHomeRepo is set to [" + this.getTavernaHomeRepo() + "].");
|
295 |
LOGGER.info("Workflow input file is [" + TavernaExtractor.getInputFileName() + "].");
|
299 |
LOGGER.info("Workflow input file is [" + this.getInputFileName() + "].");
|
296 |
LOGGER.info("Archimate output file is [" + TavernaExtractor.getArchimateOutputPath() + "].");
|
300 |
LOGGER.info("Archimate output file is [" + this.getArchimateOutputPath() + "].");
|
297 |
|
301 |
|
298 |
inputPorts = new Container(Orientation.VERTICAL);
|
302 |
inputPorts = new Container(Orientation.VERTICAL);
|
299 |
outputPorts = new Container(Orientation.VERTICAL);
|
303 |
outputPorts = new Container(Orientation.VERTICAL);
|
300 |
businessObjects = new Container(Orientation.HORIZONTAL);
|
304 |
businessObjects = new Container(Orientation.HORIZONTAL);
|
301 |
businessProcesses = new Container(Orientation.HORIZONTAL);
|
305 |
businessProcesses = new Container(Orientation.HORIZONTAL);
|
|
... |
|
... |
395 |
workflowFile, applicationFolder, relations, IAccessRelationship.READ_ACCESS);
|
399 |
workflowFile, applicationFolder, relations, IAccessRelationship.READ_ACCESS);
|
396 |
|
400 |
|
397 |
ArchiUtils.initRelation(factory.createCompositionRelationship(), desktop, workflowFile, relationsFolder,
|
401 |
ArchiUtils.initRelation(factory.createCompositionRelationship(), desktop, workflowFile, relationsFolder,
|
398 |
relations);
|
402 |
relations);
|
399 |
|
403 |
|
400 |
workflowFile.getProperties().add(createDepProperties(TavernaExtractor.getInputFileName().toString()));
|
404 |
workflowFile.getProperties().add(createDepProperties(this.getInputFileName().toString()));
|
401 |
|
405 |
|
402 |
// Orchestration Service
|
406 |
// Orchestration Service
|
403 |
parentProcessWorkflow = ArchiUtils.initElement(factory.createBusinessProcess(), dataflow.getLocalName()
|
407 |
parentProcessWorkflow = ArchiUtils.initElement(factory.createBusinessProcess(), dataflow.getLocalName()
|
404 |
+ " Process", businessFolder, businessProcesses);
|
408 |
+ " Process", businessFolder, businessProcesses);
|
405 |
workflowApplicationComponent = ArchiUtils.initElement(factory.createApplicationComponent(),
|
409 |
workflowApplicationComponent = ArchiUtils.initElement(factory.createApplicationComponent(),
|
|
... |
|
... |
419 |
relationsFolder, relations);
|
423 |
relationsFolder, relations);
|
420 |
|
424 |
|
421 |
ArchiUtils.initRelation(factory.createCompositionRelationship(), desktop, repoBundle,
|
425 |
ArchiUtils.initRelation(factory.createCompositionRelationship(), desktop, repoBundle,
|
422 |
relationsFolder, relations);
|
426 |
relationsFolder, relations);
|
423 |
|
427 |
|
424 |
if (TavernaExtractor.getTavernaHomeRepo().toFile().isDirectory()) {
|
428 |
if (this.getTavernaHomeRepo().toFile().isDirectory()) {
|
425 |
|
429 |
|
426 |
final List<File> jarFiles = new ArrayList<>();
|
430 |
final List<File> jarFiles = new ArrayList<>();
|
427 |
final PathMatcher matcher = FileSystems.getDefault()
|
431 |
final PathMatcher matcher = FileSystems.getDefault()
|
428 |
.getPathMatcher("glob:*.jar");
|
432 |
.getPathMatcher("glob:*.jar");
|
429 |
Files.walkFileTree(TavernaExtractor.getTavernaHomeRepo(), new FileVisitor<Path>() {
|
433 |
Files.walkFileTree(this.getTavernaHomeRepo(), new FileVisitor<Path>() {
|
430 |
@Override
|
434 |
@Override
|
431 |
public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes basicFileAttributes) throws IOException {
|
435 |
public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes basicFileAttributes) throws IOException {
|
432 |
return CONTINUE;
|
436 |
return CONTINUE;
|
433 |
}
|
437 |
}
|
434 |
|
438 |
|
|
... |
|
... |
455 |
for (File jarDep : jarFiles) {
|
459 |
for (File jarDep : jarFiles) {
|
456 |
String jarLocation = jarDep.getAbsolutePath();
|
460 |
String jarLocation = jarDep.getAbsolutePath();
|
457 |
repoBundle.getProperties().add(createDepProperties(jarLocation));
|
461 |
repoBundle.getProperties().add(createDepProperties(jarLocation));
|
458 |
}
|
462 |
}
|
459 |
} else {
|
463 |
} else {
|
460 |
LOGGER.error("ERROR: " + TavernaExtractor.getTavernaHomeRepo().toFile() + " is not a directory. No further dependecies processing.");
|
464 |
LOGGER.error("ERROR: " + this.getTavernaHomeRepo().toFile() + " is not a directory. No further dependecies processing.");
|
461 |
}
|
465 |
}
|
462 |
// --- END Taverna ---
|
466 |
// --- END Taverna ---
|
463 |
|
467 |
|
464 |
// --- BEGIN Events ---
|
468 |
// --- BEGIN Events ---
|
465 |
// Start Event
|
469 |
// Start Event
|
|
... |
|
... |
928 |
|
932 |
|
929 |
// create external application service for each business process/function
|
933 |
// create external application service for each business process/function
|
930 |
if (callXMLSplitterApplicationFunction == null) {
|
934 |
if (callXMLSplitterApplicationFunction == null) {
|
931 |
|
935 |
|
932 |
callXMLSplitterApplicationFunction = ArchiUtils.initElement(factory.createApplicationFunction(),
|
936 |
callXMLSplitterApplicationFunction = ArchiUtils.initElement(factory.createApplicationFunction(),
|
933 |
"XML Splitter", applicationFolder, applicationComponents);
|
937 |
"XML Splitter Built-In Service", applicationFolder, applicationComponents);
|
934 |
|
938 |
|
935 |
ArchiUtils.initRelation(factory.createAssignmentRelationship(), callXMLSplitterApplicationFunction,
|
939 |
ArchiUtils.initRelation(factory.createAssignmentRelationship(), callXMLSplitterApplicationFunction,
|
936 |
workflowApplicationComponent, relationsFolder, relations);
|
940 |
workflowApplicationComponent, relationsFolder, relations);
|
937 |
|
941 |
|
938 |
ArchiUtils.initRelation(factory.createRealisationRelationship(), taverna, callXMLSplitterApplicationFunction,
|
942 |
ArchiUtils.initRelation(factory.createRealisationRelationship(), taverna, callXMLSplitterApplicationFunction,
|
|
... |
|
... |
948 |
relationsFolder, relations);
|
952 |
relationsFolder, relations);
|
949 |
|
953 |
|
950 |
ArchiUtils.initRelation(factory.createUsedByRelationship(), callXMLSplitterApplicationFunction,
|
954 |
ArchiUtils.initRelation(factory.createUsedByRelationship(), callXMLSplitterApplicationFunction,
|
951 |
processorProcessMap.get(processor), relationsFolder, relations);
|
955 |
processorProcessMap.get(processor), relationsFolder, relations);
|
952 |
|
956 |
|
|
|
957 |
LOGGER.debug("Get input elements of process "+ArchiUtils.getInputElementsOfProcess(processorProcessMap.get(processor),
|
|
|
958 |
relations).size());
|
|
|
959 |
// creating request response data objects
|
|
|
960 |
for (IArchimateElement inputElement : ArchiUtils.getInputElementsOfProcess(processorProcessMap.get(processor),
|
|
|
961 |
relations)) {
|
|
|
962 |
|
|
|
963 |
LOGGER.debug("inputElement = "+inputElement.getName());
|
|
|
964 |
|
|
|
965 |
if (!business2dataMap.containsKey(inputElement)) {
|
|
|
966 |
|
|
|
967 |
IDataObject requestObject = ArchiUtils.initElement(factory.createDataObject(), inputElement.getName(),
|
|
|
968 |
applicationFolder, applicationComponents);
|
|
|
969 |
|
|
|
970 |
business2dataMap.put((IBusinessObject) inputElement, requestObject);
|
|
|
971 |
|
|
|
972 |
ArchiUtils.initRelation(factory.createRealisationRelationship(), requestObject, inputElement,
|
|
|
973 |
relationsFolder, relations);
|
|
|
974 |
}
|
|
|
975 |
ArchiUtils.initAccessRelation(factory.createAccessRelationship(), appService,
|
|
|
976 |
business2dataMap.get(inputElement), applicationFolder, relations, IAccessRelationship.READ_ACCESS);
|
|
|
977 |
|
|
|
978 |
}
|
|
|
979 |
|
|
|
980 |
LOGGER.debug("Get output elements of process "+ArchiUtils.getInputElementsOfProcess(processorProcessMap.get(processor),
|
|
|
981 |
relations).size());
|
|
|
982 |
for (IArchimateElement outputElement : ArchiUtils.getOutputElementsOfProcess(
|
|
|
983 |
processorProcessMap.get(processor), relations)) {
|
|
|
984 |
|
|
|
985 |
LOGGER.debug("inputElement = "+outputElement.getName());
|
|
|
986 |
|
|
|
987 |
if (!business2dataMap.containsKey(outputElement)) {
|
|
|
988 |
|
|
|
989 |
IDataObject responseObject = ArchiUtils.initElement(factory.createDataObject(),
|
|
|
990 |
outputElement.getName(), applicationFolder, applicationComponents);
|
|
|
991 |
|
|
|
992 |
ArchiUtils.initRelation(factory.createRealisationRelationship(), responseObject, outputElement,
|
|
|
993 |
relationsFolder, relations);
|
|
|
994 |
|
|
|
995 |
business2dataMap.put((IBusinessObject) outputElement, responseObject);
|
|
|
996 |
}
|
|
|
997 |
|
|
|
998 |
ArchiUtils
|
|
|
999 |
.initAccessRelation(factory.createAccessRelationship(), appService,
|
|
|
1000 |
business2dataMap.get(outputElement), applicationFolder, relations,
|
|
|
1001 |
IAccessRelationship.WRITE_ACCESS);
|
|
|
1002 |
|
|
|
1003 |
}
|
|
|
1004 |
}
|
|
|
1005 |
|
|
|
1006 |
public void processXPathActivity(IFolder infrastructureFolder, IFolder motivationFolder,
|
|
|
1007 |
IFolder applicationFolder, IFolder relationsFolder, IApplicationComponent workflowApplicationComponent,
|
|
|
1008 |
HashMap<Processor, IBusinessProcess> processorProcessMap, Processor processor, Activity<?> a)
|
|
|
1009 |
throws IOException {
|
|
|
1010 |
|
|
|
1011 |
//beanshellScripts.add((BeanshellActivity) a);
|
|
|
1012 |
|
|
|
1013 |
LOGGER.debug("XPath script found = " + processor.getLocalName());
|
|
|
1014 |
|
|
|
1015 |
//XPathActivity xPathActivity = (XPathActivity) a;
|
|
|
1016 |
|
|
|
1017 |
// create external application service for each business process/function
|
|
|
1018 |
if (callXPathApplicationFunction == null) {
|
|
|
1019 |
|
|
|
1020 |
callXPathApplicationFunction = ArchiUtils.initElement(factory.createApplicationFunction(),
|
|
|
1021 |
"XPath Built-In Service", applicationFolder, applicationComponents);
|
|
|
1022 |
|
|
|
1023 |
ArchiUtils.initRelation(factory.createAssignmentRelationship(), callXPathApplicationFunction,
|
|
|
1024 |
workflowApplicationComponent, relationsFolder, relations);
|
|
|
1025 |
|
|
|
1026 |
ArchiUtils.initRelation(factory.createRealisationRelationship(), taverna, callXPathApplicationFunction,
|
|
|
1027 |
relationsFolder, relations);
|
|
|
1028 |
}
|
|
|
1029 |
|
|
|
1030 |
IApplicationService appService = ArchiUtils.initElement(factory.createApplicationService(),
|
|
|
1031 |
processor.getLocalName(), applicationFolder, externalApplicationServices);
|
|
|
1032 |
|
|
|
1033 |
appService.getProperties().add(createDepProperties(BeanshellActivity.class));
|
|
|
1034 |
|
|
|
1035 |
ArchiUtils.initRelation(factory.createUsedByRelationship(), appService, processorProcessMap.get(processor),
|
|
|
1036 |
relationsFolder, relations);
|
|
|
1037 |
|
|
|
1038 |
ArchiUtils.initRelation(factory.createUsedByRelationship(), callXPathApplicationFunction,
|
|
|
1039 |
processorProcessMap.get(processor), relationsFolder, relations);
|
|
|
1040 |
|
953 |
// IArtifact script = (IArtifact) ArchiUtils.initElement(factory.createArtifact(), processor.getLocalName()
|
1041 |
IArtifact script = (IArtifact) ArchiUtils.initElement(factory.createArtifact(), processor.getLocalName()
|
954 |
// + "Script", infrastructureFolder, nodeElements);
|
1042 |
, infrastructureFolder, nodeElements);
|
955 |
|
1043 |
|
|
|
1044 |
XPathActivityConfigurationBean c = (XPathActivityConfigurationBean) a.getConfiguration();
|
|
|
1045 |
String ex = c.getXpathExpression() != null ? c.getXpathExpression() : "NO_EXPRESSION_AVAILABLE";
|
|
|
1046 |
String doc = c.getXmlDocument() != null ? c.getXmlDocument() : "NO_XML_DOCUMENT_AVAILABLE";
|
|
|
1047 |
|
|
|
1048 |
IProperty property = factory.createProperty();
|
|
|
1049 |
property.setKey("expression");
|
|
|
1050 |
property.setValue(ex);
|
|
|
1051 |
script.getProperties().add(property);
|
|
|
1052 |
|
|
|
1053 |
IProperty property_document = factory.createProperty();
|
|
|
1054 |
property_document.setKey("document");
|
|
|
1055 |
property_document.setValue(doc);
|
|
|
1056 |
script.getProperties().add(property_document);
|
|
|
1057 |
|
956 |
// ArchiUtils.initRelation(factory.createCompositionRelationship(), workflowFile, script, relationsFolder,
|
1058 |
ArchiUtils.initRelation(factory.createCompositionRelationship(), workflowFile, script, relationsFolder,
|
957 |
// relations);
|
1059 |
relations);
|
958 |
|
1060 |
|
959 |
// ArchiUtils
|
1061 |
ArchiUtils
|
960 |
// .initRelation(factory.createRealisationRelationship(), script, appService, relationsFolder, relations);
|
1062 |
.initRelation(factory.createRealisationRelationship(), script, appService, relationsFolder, relations);
|
961 |
|
1063 |
|
962 |
// creating request response data objects
|
1064 |
// creating request response data objects
|
963 |
for (IArchimateElement inputElement : ArchiUtils.getInputElementsOfProcess(processorProcessMap.get(processor),
|
1065 |
for (IArchimateElement inputElement : ArchiUtils.getInputElementsOfProcess(processorProcessMap.get(processor),
|
964 |
relations)) {
|
1066 |
relations)) {
|
965 |
|
1067 |
|
|
... |
|
... |
1095 |
LOGGER.debug("\t Dependency for " + processor.getLocalName() + " [" + item + "]");
|
1197 |
LOGGER.debug("\t Dependency for " + processor.getLocalName() + " [" + item + "]");
|
1096 |
|
1198 |
|
1097 |
IArtifact beanshellScriptDep = (IArtifact) ArchiUtils.initElement(factory.createArtifact(), item,
|
1199 |
IArtifact beanshellScriptDep = (IArtifact) ArchiUtils.initElement(factory.createArtifact(), item,
|
1098 |
infrastructureFolder, nodeElements);
|
1200 |
infrastructureFolder, nodeElements);
|
1099 |
|
1201 |
|
1100 |
ArchiUtils.initRelationNodeElement(factory.createAssociationRelationship(), script, beanshellScriptDep,
|
1202 |
ArchiUtils.initRelation(factory.createAssociationRelationship(), script, beanshellScriptDep,
|
1101 |
relationsFolder, nodeElements);
|
1203 |
relationsFolder);
|
1102 |
|
1204 |
|
1103 |
ArchiUtils.initRelationNodeElement(factory.createCompositionRelationship(), beanshellScriptDep, desktop,
|
1205 |
ArchiUtils.initRelation(factory.createCompositionRelationship(), beanshellScriptDep, desktop,
|
1104 |
relationsFolder, nodeElements);
|
1206 |
relationsFolder);
|
1105 |
|
1207 |
|
1106 |
// Do the license checking
|
1208 |
// Do the license checking
|
1107 |
String fileName = TavernaExtractor.getTavernaHomeLib() + File.separator + item;
|
1209 |
String fileName = this.getTavernaHomeLib() + File.separator + item;
|
1108 |
|
1210 |
|
1109 |
IProperty jarLocation = factory.createProperty();
|
1211 |
IProperty jarLocation = factory.createProperty();
|
1110 |
jarLocation.setKey("hasSourceLocation");
|
1212 |
jarLocation.setKey("hasSourceLocation");
|
1111 |
jarLocation.setValue(fileName);
|
1213 |
jarLocation.setValue(fileName);
|
1112 |
beanshellScriptDep.getProperties().add(jarLocation);
|
1214 |
beanshellScriptDep.getProperties().add(jarLocation);
|
|
... |
|
... |
1757 |
for (OutputPort outputPort : processor.getOutputPorts()) {
|
1859 |
for (OutputPort outputPort : processor.getOutputPorts()) {
|
1758 |
outputPorts.add(outputPort);
|
1860 |
outputPorts.add(outputPort);
|
1759 |
}
|
1861 |
}
|
1760 |
}
|
1862 |
}
|
1761 |
|
1863 |
|
|
|
1864 |
//TODO: needs improvements -> hasNoPrecedentProcessor not working if only one non-constant value processor exists!!
|
1762 |
List<Processor> startingProcessors = new ArrayList<Processor>();
|
1865 |
List<Processor> startingProcessors = new ArrayList<Processor>();
|
1763 |
for (Processor processor : dataflow.getProcessors()) {
|
1866 |
for (Processor processor : dataflow.getProcessors()) {
|
1764 |
|
1867 |
|
1765 |
// detect if first step processor
|
1868 |
if (ArchiUtils.isValueProcessor(processor)) {
|
|
|
1869 |
break;
|
|
|
1870 |
}
|
|
|
1871 |
else{
|
|
|
1872 |
startingProcessors.add(processor);
|
|
|
1873 |
}
|
|
|
1874 |
}
|
|
|
1875 |
if(startingProcessors.size() == 1){
|
|
|
1876 |
return startingProcessors;
|
|
|
1877 |
}
|
|
|
1878 |
|
|
|
1879 |
startingProcessors = new ArrayList<Processor>();
|
|
|
1880 |
for (Processor processor : dataflow.getProcessors()) {
|
1766 |
|
1881 |
|
1767 |
if (ArchiUtils.isValueProcessor(processor)) {
|
1882 |
if (ArchiUtils.isValueProcessor(processor)) {
|
1768 |
break;
|
1883 |
break;
|
1769 |
}
|
1884 |
}
|
1770 |
|
1885 |
|
|
... |
|
... |
1842 |
fw.close();
|
1957 |
fw.close();
|
1843 |
|
1958 |
|
1844 |
// Dot to SVG
|
1959 |
// Dot to SVG
|
1845 |
File svgTmp = new File(tmpDirPath + File.separator + "tavernaExtractorToArchimate.dot.svg");
|
1960 |
File svgTmp = new File(tmpDirPath + File.separator + "tavernaExtractorToArchimate.dot.svg");
|
1846 |
|
1961 |
|
1847 |
String[] COMMAND = {TavernaExtractor.getDotLocation().toString(), "-Tsvg", dotTmp.getAbsolutePath(), "-o", svgTmp.getAbsolutePath()};
|
1962 |
String[] COMMAND = {this.getDotLocation().toString(), "-Tsvg", dotTmp.getAbsolutePath(), "-o", svgTmp.getAbsolutePath()};
|
1848 |
|
1963 |
|
1849 |
LOGGER.debug("Running command '" + StringUtils.join(COMMAND, " ") + "'.");
|
1964 |
LOGGER.debug("Running command '" + StringUtils.join(COMMAND, " ") + "'.");
|
1850 |
|
1965 |
|
1851 |
ProcessBuilder proc = new ProcessBuilder(COMMAND);
|
1966 |
ProcessBuilder proc = new ProcessBuilder(COMMAND);
|
1852 |
Process process = proc.start();
|
1967 |
Process process = proc.start();
|
|
... |
|
... |
1965 |
|
2080 |
|
1966 |
printPortInformation(processor);
|
2081 |
printPortInformation(processor);
|
1967 |
|
2082 |
|
1968 |
// TODO UnrecognizedActivity detected !!
|
2083 |
// TODO UnrecognizedActivity detected !!
|
1969 |
if (a instanceof UnrecognizedActivity) {
|
2084 |
if (a instanceof UnrecognizedActivity) {
|
1970 |
LOGGER.error("PROBLEM: UnrecognizedActivity detected! ");
|
2085 |
LOGGER.error("\tPROBLEM: UnrecognizedActivity detected! ");
|
1971 |
}
|
2086 |
}
|
1972 |
// TODO DisabledActivity detected !!
|
2087 |
// TODO DisabledActivity detected !!
|
1973 |
// From the javadoc: A disabled activity is a wrapper for an Activity that is offline or similarly
|
2088 |
// From the javadoc: A disabled activity is a wrapper for an Activity that is offline or similarly
|
1974 |
// disabled
|
2089 |
// disabled
|
1975 |
else if (a instanceof DisabledActivity) {
|
2090 |
else if (a instanceof DisabledActivity) {
|
1976 |
LOGGER.error("PROBLEM: DisabledActivity detected! ");
|
2091 |
LOGGER.error("\tPROBLEM: DisabledActivity detected! ");
|
1977 |
// TODO: create a note element with information
|
2092 |
// TODO: create a note element with information
|
1978 |
}
|
2093 |
}
|
1979 |
|
2094 |
|
1980 |
// nested worklfow
|
2095 |
// nested worklfow
|
1981 |
else if (a instanceof DataflowActivity) {
|
2096 |
else if (a instanceof DataflowActivity) {
|
|
... |
|
... |
2034 |
workflowApplicationComponent, processorProcessMap, callWebServiceApplicationFunction,
|
2149 |
workflowApplicationComponent, processorProcessMap, callWebServiceApplicationFunction,
|
2035 |
processor, processorName, a);
|
2150 |
processor, processorName, a);
|
2036 |
}
|
2151 |
}
|
2037 |
else if (a instanceof XMLInputSplitterActivity || a instanceof XMLOutputSplitterActivity) {
|
2152 |
else if (a instanceof XMLInputSplitterActivity || a instanceof XMLOutputSplitterActivity) {
|
2038 |
processXMLSplitterActivity(infrastructureFolder, motivationFolder, applicationFolder,
|
2153 |
processXMLSplitterActivity(infrastructureFolder, motivationFolder, applicationFolder,
|
|
|
2154 |
relationsFolder, workflowApplicationComponent, processorProcessMap, processor, a);
|
|
|
2155 |
}
|
|
|
2156 |
else if (a instanceof XPathActivity){
|
|
|
2157 |
LOGGER.info("XPathActivity has to be done");
|
|
|
2158 |
processXPathActivity(infrastructureFolder, motivationFolder, applicationFolder,
|
|
|
2159 |
relationsFolder, workflowApplicationComponent, processorProcessMap, processor, a);
|
|
|
2160 |
}
|
|
|
2161 |
else if (a instanceof LocalworkerActivity){
|
|
|
2162 |
|
|
|
2163 |
/*
|
|
|
2164 |
Localworker Activity equals BeanshellActivity ?!
|
|
|
2165 |
*/
|
|
|
2166 |
processBeanshellActivity(infrastructureFolder, motivationFolder, applicationFolder,
|
2039 |
relationsFolder, workflowApplicationComponent, processorProcessMap, processor, a);
|
2167 |
relationsFolder, workflowApplicationComponent, processorProcessMap, processor, a);
|
2040 |
}
|
2168 |
}
|
2041 |
else{
|
2169 |
else{
|
2042 |
LOGGER.debug("Unfortunately, we do not process that kind of activity.");
|
2170 |
LOGGER.debug("Unfortunately, we do not process that kind of activity.");
|
2043 |
}
|
2171 |
}
|
|
... |
|
... |
2300 |
// + ": " + sink.getClass());
|
2428 |
// + ": " + sink.getClass());
|
2301 |
}
|
2429 |
}
|
2302 |
}
|
2430 |
}
|
2303 |
}
|
2431 |
}
|
2304 |
}
|
2432 |
}
|
2305 |
|
|
|
2306 |
}
|
2433 |
}
|
2307 |
|
2434 |
|
2308 |
private Dataflow getDataflowRemote() throws TavernaExtractorException {
|
2435 |
private Dataflow getDataflowRemote() throws TavernaExtractorException {
|
2309 |
|
2436 |
|
2310 |
try {
|
2437 |
try {
|
|
... |
|
... |
2353 |
|
2480 |
|
2354 |
|
2481 |
|
2355 |
private void saveRemote(IArchimateModel model) throws TavernaExtractorException {
|
2482 |
private void saveRemote(IArchimateModel model) throws TavernaExtractorException {
|
2356 |
|
2483 |
|
2357 |
// Set new file
|
2484 |
// Set new file
|
2358 |
File outFile = TavernaExtractor.getArchimateOutputPath().toFile();
|
2485 |
File outFile = this.getArchimateOutputPath().toFile();
|
2359 |
model.setFile(outFile);
|
2486 |
model.setFile(outFile);
|
2360 |
|
2487 |
|
2361 |
// Set model version
|
2488 |
// Set model version
|
2362 |
model.setVersion(ModelVersion.VERSION);
|
2489 |
model.setVersion(ModelVersion.VERSION);
|
2363 |
|
2490 |
|
|
... |
|
... |
2402 |
}
|
2529 |
}
|
2403 |
|
2530 |
|
2404 |
private void saveLocal(IArchimateModel model) throws IOException {
|
2531 |
private void saveLocal(IArchimateModel model) throws IOException {
|
2405 |
|
2532 |
|
2406 |
// Set new file
|
2533 |
// Set new file
|
2407 |
File outFile = TavernaExtractor.getArchimateOutputPath().toFile();
|
2534 |
File outFile = this.getArchimateOutputPath().toFile();
|
2408 |
model.setFile(outFile);
|
2535 |
model.setFile(outFile);
|
2409 |
|
2536 |
|
2410 |
// Set model version
|
2537 |
// Set model version
|
2411 |
model.setVersion(ModelVersion.VERSION);
|
2538 |
model.setVersion(ModelVersion.VERSION);
|
2412 |
|
2539 |
|