I added the above to the component exchange class after using the sirius interpreter to check if that was the correct Java function. It was and it worked for component exchanges!
For Physical Links and setting physical source ports, the interpreter suggests that instead of âaql:self.sourceâ we use, âaql:self.sourcePhysicalPortâ to identify the source port.
As a result of this Iâve added the below function under the Physical Link class in the simplified capella api:
For reference, this is the error message (which indicates that it may not be included in a file that I cannot access):
org.eclipse.ease.ScriptExecutionException: Traceback (most recent call last):
File âL/Python4Capella/WIP/Exchange Link Accelerator/Road Map/EA Import Development/EA_Paste_PhysicalLinks.pyâ, line 133, in
File âL/Python4Capella/simplified_api/capella.pyâ, line 2598, in set_source_port
File âC:\Users\acook\Capella Suite\Capella 1.4.2\Capella 1.4.2\Capella 1.4.2\eclipse\plugins\py4j-python_0.10.9.3-bnd-2odeag\src\py4j\java_gateway.pyâ, line 1322, in call
answer, self.gateway_client, self.target_id, self.name)
File âC:\Users\acook\Capella Suite\Capella 1.4.2\Capella 1.4.2\Capella 1.4.2\eclipse\plugins\py4j-python_0.10.9.3-bnd-2odeag\src\py4j\protocol.pyâ, line 332, in get_return_value
format(target_id, â.â, name, value))
py4j.protocol.Py4JError: An error occurred while calling o1096.setSourcePhysicalPort. Trace:
py4j.Py4JException: Method setSourcePhysicalPort([class org.polarsys.capella.core.data.cs.impl.PhysicalPortImpl]) does not exist
at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:318)
at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:326)
at py4j.Gateway.invoke(Gateway.java:274)
at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
at py4j.commands.CallCommand.execute(CallCommand.java:79)
at py4j.ClientServerConnection.sendCommand(ClientServerConnection.java:244)
at py4j.CallbackClient.sendCommand(CallbackClient.java:384)
at py4j.CallbackClient.sendCommand(CallbackClient.java:356)
at py4j.reflection.PythonProxyHandler.invoke(PythonProxyHandler.java:106)
at com.sun.proxy.$Proxy30.executeScript(Unknown Source)
at org.eclipse.ease.lang.python.py4j.internal.Py4jScriptEngine.internalExecute(Py4jScriptEngine.java:236)
at org.eclipse.ease.lang.python.py4j.internal.Py4jScriptEngine.execute(Py4jScriptEngine.java:226)
at org.eclipse.ease.AbstractScriptEngine.inject(AbstractScriptEngine.java:245)
at org.eclipse.ease.AbstractScriptEngine.run(AbstractScriptEngine.java:309)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
The trace suggest you called set_source_port() on a PhysicalPort instead of a PhysicalLink:
Method setSourcePhysicalPort([class org.polarsys.capella.core.data.cs.impl.PhysicalPortImpl]) does not exist
You should double check the type of the element you are calling the method from. Maybe you passed a Java PhysicalPort to the constructor of the Python class PhysicalLink ?
Thanks for your speedy response!
You make a good point but Iâm not sure how Iâm calling a PhysicalPort. In the section of my script that is calling these functions I call the PhysicalLink() class here:
#prepare the link to be added
PL = PhysicalLink()
PL.set_name(Exchange_Name)
PL.set_source_port(PPS)
PL.set_target_port(PPT)
Iâm attempting to assign the source (PPS) and target (PPT) target port to PL before I add it to the model. Any idea why it would then be trying the function/method for a port?