Skip to content

Commit

Permalink
feat(main): Change plugin build to support 4diac v2.x versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro-ricardo committed Jul 20, 2024
1 parent b109868 commit 76ab7c3
Show file tree
Hide file tree
Showing 17 changed files with 69 additions and 66 deletions.
2 changes: 1 addition & 1 deletion branding/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Aimirim UAO Deployment
Bundle-SymbolicName: com.asti.branding;singleton:=true
Bundle-Version: 3.1.0.qualifier
Bundle-Version: 2.1.0.qualifier
Bundle-Vendor: Aimirim STI
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
2 changes: 1 addition & 1 deletion branding/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.asti</groupId>
<artifactId>parent</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>2.1.0-SNAPSHOT</version>
</parent>

<artifactId>com.asti.branding</artifactId>
Expand Down
File renamed without changes.
Binary file modified docs/TrustSigners.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion feature/category.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature url="features/com.asti.fordiac.deployment_3.1.0.qualifier.jar" id="com.asti.fordiac.deployment" version="3.1.0.qualifier">
<feature url="features/com.asti.fordiac.deployment_2.1.0.qualifier.jar" id="com.asti.fordiac.deployment" version="2.1.0.qualifier">
<category name="com.asti.fordiac.deployment" label="Aimirim 4diac Plugins"/>
</feature>
<category-def name="com.asti.fordiac.deployment" label="Aimirim 4diac Plugins">
Expand Down
2 changes: 1 addition & 1 deletion feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="com.asti.fordiac.deployment"
label="Aimirim UAO Deployment"
version="3.1.0.qualifier"
version="2.1.0.qualifier"
plugin="com.asti.branding"
provider-name="Aimirim STI">

Expand Down
2 changes: 1 addition & 1 deletion feature/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.asti</groupId>
<artifactId>parent</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>2.1.0-SNAPSHOT</version>
</parent>

<artifactId>com.asti.fordiac.deployment</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion package/category.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature url="features/com.asti.fordiac.deployment_3.1.0.qualifier.jar" id="com.asti.fordiac.deployment" version="3.1.0.qualifier">
<feature url="features/com.asti.fordiac.deployment_2.1.0.qualifier.jar" id="com.asti.fordiac.deployment" version="2.1.0.qualifier">
<category name="com.asti.fordiac.deployment"/>
</feature>
<category-def name="com.asti.fordiac.deployment" label="Aimirim 4diac Plugins">
Expand Down
2 changes: 1 addition & 1 deletion package/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.asti</groupId>
<artifactId>parent</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>2.1.0-SNAPSHOT</version>
</parent>
<packaging>eclipse-repository</packaging>

Expand Down
2 changes: 1 addition & 1 deletion plugin/.classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-16"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
Expand Down
14 changes: 7 additions & 7 deletions plugin/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Aimirim UAO Deployment
Bundle-SymbolicName: com.asti.fordiac.ide.deployment.uao;singleton:=true
Bundle-Version: 3.1.0.qualifier
Bundle-Version: 2.1.0.qualifier
Bundle-Vendor: Aimirim STI
Automatic-Module-Name: com.asti.fordiac.ide.deployment.uao
Bundle-RequiredExecutionEnvironment: JavaSE-21
Bundle-RequiredExecutionEnvironment: JavaSE-16
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.fordiac.ide.ui;bundle-version="[3.0.0,4.0.0)",
org.eclipse.fordiac.ide.deployment;bundle-version="[3.0.0,4.0.0)",
org.eclipse.fordiac.ide.deployment.iec61499;bundle-version="[3.0.0,4.0.0)",
org.eclipse.fordiac.ide.ui;bundle-version="[2.0.0,3.0.0)",
org.eclipse.fordiac.ide.deployment;bundle-version="[2.0.0,3.0.0)",
org.eclipse.fordiac.ide.deployment.iec61499;bundle-version="[2.0.0,3.0.0)",
com.google.gson;bundle-version="2.10.1",
com.neovisionaries.ws.client;bundle-version="2.14.0",
org.apache.httpcomponents.httpcore,
org.apache.httpcomponents.httpclient,
org.apache.commons.commons-codec,
bcprov;bundle-version="[1.65.0,2.0.0]"
org.apache.commons.codec,
org.bouncycastle.bcprov;bundle-version="1.65.0"
Export-Package: com.asti.fordiac.ide.deployment.uao
4 changes: 2 additions & 2 deletions plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.asti</groupId>
<artifactId>parent</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>2.1.0-SNAPSHOT</version>
</parent>


Expand Down Expand Up @@ -107,4 +107,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,14 @@
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl;
import org.eclipse.fordiac.ide.deployment.Activator;
import org.eclipse.fordiac.ide.deployment.data.ConnectionDeploymentData;
import org.eclipse.fordiac.ide.deployment.data.FBDeploymentData;
import org.eclipse.fordiac.ide.deployment.devResponse.Response;
import org.eclipse.fordiac.ide.deployment.exceptions.DeploymentException;
import org.eclipse.fordiac.ide.deployment.iec61499.ResponseMapping;
import org.eclipse.fordiac.ide.deployment.interactors.IDeviceManagementInteractor;
import org.eclipse.fordiac.ide.deployment.monitoringbase.MonitoringBaseElement;
import com.asti.fordiac.ide.deployment.uao.helpers.Constants;
import com.asti.fordiac.ide.deployment.uao.helpers.UAOClient;
import com.asti.fordiac.ide.deployment.uao.helpers.WatchItem;
import org.eclipse.fordiac.ide.deployment.util.DeploymentHelper;
import org.eclipse.fordiac.ide.deployment.util.IDeploymentListener;
import org.eclipse.fordiac.ide.model.libraryElement.Device;
Expand All @@ -59,12 +57,14 @@
import org.eclipse.fordiac.ide.model.libraryElement.IInterfaceElement;
import org.eclipse.fordiac.ide.model.libraryElement.Resource;
import org.eclipse.fordiac.ide.model.libraryElement.VarDeclaration;
import org.eclipse.fordiac.ide.ui.FordiacLogHelper;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;

import com.asti.fordiac.ide.deployment.uao.helpers.Constants;
import com.asti.fordiac.ide.deployment.uao.helpers.UAOClient;
import com.asti.fordiac.ide.deployment.uao.helpers.WatchItem;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
Expand Down Expand Up @@ -104,14 +104,14 @@ public enum ConnectionStatus {
@Override
public void onConnected(final WebSocket websocket, final Map<String, List<String>> headers) {
connectionStatus = ConnectionStatus.CONNECTED;
FordiacLogHelper.logWarning("UAOClient Connected!"); //$NON-NLS-1$
Activator.getDefault().logWarning("UAOClient Connected!"); //$NON-NLS-1$
}

@Override
public void onDisconnected(final WebSocket websocket, final WebSocketFrame serverCloseFrame,
final WebSocketFrame clientCloseFrame, final boolean closedByServer) throws DeploymentException {
connectionStatus = ConnectionStatus.DISCONNECTED;
FordiacLogHelper.logWarning("UAOClient Disconnected!"); //$NON-NLS-1$
Activator.getDefault().logWarning("UAOClient Disconnected!"); //$NON-NLS-1$
}
};

Expand Down Expand Up @@ -167,7 +167,7 @@ public void connect() throws DeploymentException {
error = e.getMessage();
}
client.regenKeyPair();
FordiacLogHelper.logInfo("UAODeploymentExecutor | Auth retry " + (retry + 1)); //$NON-NLS-1$
Activator.getDefault().logInfo("UAODeploymentExecutor | Auth retry " + (retry + 1)); //$NON-NLS-1$
retry++;
}

Expand Down Expand Up @@ -218,12 +218,14 @@ public void createResource(final Resource resource) throws DeploymentException {

@Override
public void writeResourceParameter(final Resource resource, final String parameter, final String value) {
// FordiacLogHelper.logInfo("UAODeploymentExecutor | writeResourceParameter "+parameter+"="+value); //$NON-NLS-1$
// Activator.getDefault().logInfo("UAODeploymentExecutor |
// writeResourceParameter "+parameter+"="+value); //$NON-NLS-1$
}

@Override
public void writeDeviceParameter(final Device device, final String parameter, final String value) {
// FordiacLogHelper.logInfo("UAODeploymentExecutor | writeDeviceParameter "+parameter+"="+value); //$NON-NLS-1$
// Activator.getDefault().logInfo("UAODeploymentExecutor | writeDeviceParameter
// "+parameter+"="+value); //$NON-NLS-1$
}

@Override
Expand Down Expand Up @@ -277,7 +279,7 @@ public void createConnection(final Resource res, final ConnectionDeploymentData

@Override
public void startFB(final Resource res, final FBDeploymentData fbData) throws DeploymentException {
// FordiacLogHelper.logInfo("UAODeploymentExecutor | startFB"); //$NON-NLS-1$
// Activator.getDefault().logInfo("UAODeploymentExecutor | startFB"); //$NON-NLS-1$
}

@Override
Expand All @@ -293,16 +295,16 @@ public void startResource(final Resource resource) throws DeploymentException {
fbNetwork.appendChild(eventConnection);
fbNetwork.appendChild(dataConnection);
// Start deploy
client.connectionCheck();
client.connectionCheck();
final String from = client.getDeviceState();
client.deploy(deployXml, projectGuid, snapshotGuid);
final String to = client.getDeviceState();
FordiacLogHelper.logInfo("UAODeploymentExecutor | Runtime state from \"" + from + "\" to \"" + to + "\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Activator.getDefault().logInfo("UAODeploymentExecutor | Runtime state from \"" + from + "\" to \"" + to + "\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}

@Override
public void startDevice(final Device dev) throws DeploymentException {
// Appears not to be needed.
// Appears not to be needed.
}

@Override
Expand All @@ -311,7 +313,7 @@ public void deleteResource(final String resName) throws DeploymentException {
final String from = client.getDeviceState();
client.flow_command("clean"); //$NON-NLS-1$
final String to = client.getDeviceState();
FordiacLogHelper.logInfo("UAODeploymentExecutor | Runtime state from \"" + from + "\" to \"" + to + "\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Activator.getDefault().logInfo("UAODeploymentExecutor | Runtime state from \"" + from + "\" to \"" + to + "\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}

@Override
Expand Down Expand Up @@ -356,7 +358,7 @@ public Response readWatches() throws DeploymentException {
forceResponse = client.forceQuery(res.getName());
} catch (final DeploymentException e) {
e.printStackTrace();
FordiacLogHelper.logError(e.getMessage());
Activator.getDefault().logError(e.getMessage());
// Thread.currentThread().interrupt();
throw e;
}
Expand Down Expand Up @@ -409,7 +411,7 @@ public void addWatch(final MonitoringBaseElement element) throws DeploymentExcep
}
watch_items.get(resName).add(wele);
watchid += 1;
FordiacLogHelper.logInfo("UAODeploymentExecutor | addWatch " + portPath + " Added"); //$NON-NLS-1$ //$NON-NLS-2$
Activator.getDefault().logInfo("UAODeploymentExecutor | addWatch " + portPath + " Added"); //$NON-NLS-1$ //$NON-NLS-2$
}
}

Expand All @@ -430,7 +432,7 @@ public void removeWatch(final MonitoringBaseElement element) throws DeploymentEx
final boolean check = client.removeWatch(resName, id);
if (check) {
watch_items.get(resName).remove(item);
FordiacLogHelper.logInfo("UAODeploymentExecutor | removeWatch " + portPath + " Removed"); //$NON-NLS-1$ //$NON-NLS-2$
Activator.getDefault().logInfo("UAODeploymentExecutor | removeWatch " + portPath + " Removed"); //$NON-NLS-1$ //$NON-NLS-2$
}
} catch (final DeploymentException e) {
throw e;
Expand Down Expand Up @@ -528,7 +530,7 @@ private static String prefixUAO(final String original) {
private static boolean getUseSsl(final Device dev) throws DeploymentException {
for (final VarDeclaration varDecl : dev.getVarDeclarations()) {
if ("SSL".equalsIgnoreCase(varDecl.getName())) { //$NON-NLS-1$
final String val = DeploymentHelper.getVariableValue(varDecl);
final String val = DeploymentHelper.getVariableValue(varDecl, dev.getAutomationSystem());
if (null != val) {
return (Boolean.parseBoolean(val));
}
Expand All @@ -544,11 +546,10 @@ private static boolean getUseSsl(final Device dev) throws DeploymentException {
*/
private UAOClient createClient(final Device dev) {
String mgrId = ""; //$NON-NLS-1$
try {
mgrId = DeploymentHelper.getMgrID(dev);
} catch (final DeploymentException e) {
FordiacLogHelper
.logError(MessageFormat.format(Messages.UAODeploymentExecutor_GetMgrIDFailed, e.getMessage()), e);
mgrId = DeploymentHelper.getMgrID(dev);
if (mgrId.equals("")) {
Activator.getDefault().logError(
MessageFormat.format(Messages.UAODeploymentExecutor_GetMgrIDFailed, "Empty MGR_ID value."));
}
// Remove Quotes from string
mgrId = mgrId.substring(1, mgrId.length() - 1);
Expand All @@ -557,16 +558,16 @@ private UAOClient createClient(final Device dev) {
try {
ssl = getUseSsl(dev);
} catch (final DeploymentException e) {
FordiacLogHelper.logError(MessageFormat.format(Messages.UAODeploymentExecutor_GetSSLFailed, e.getMessage()),
e);
Activator.getDefault()
.logError(MessageFormat.format(Messages.UAODeploymentExecutor_GetSSLFailed, e.getMessage()), e);
}

UAOClient newClient = null;
try {
newClient = new UAOClient(mgrId, 0, ssl);
newClient.addListener(callbacks);
} catch (final DeploymentException e) {
FordiacLogHelper.logError(
Activator.getDefault().logError(
MessageFormat.format(Messages.UAODeploymentExecutor_ClientConnectionFailed, e.getMessage()), e);
}

Expand Down Expand Up @@ -622,7 +623,7 @@ private Element createSystem(final Document doc, final Device dev) {
final LocalDateTime now = LocalDateTime.now();
final String version = System.getProperty("org.eclipse.fordiac.ide.version"); //$NON-NLS-1$

final String projName = dev.getTypeEntry().getTypeLibrary().getSystems().keySet().toArray()[0].toString();
final String projName = "4diac Project"; //$NON-NLS-1$

final Element sysEl = doc.createElement("System"); //$NON-NLS-1$

Expand Down Expand Up @@ -782,7 +783,7 @@ private Response parseWatchResponse(final Map<String, List<WatchItem>> watches,
return (Constants.EMPTY_RESPONSE);
}
final String xml = xmlToString(doc);
// FordiacLogHelper.logInfo("Pooling: " + xml); //$NON-NLS-1$
// Activator.getDefault().logInfo("Pooling: " + xml); //$NON-NLS-1$
return parseXMLResponse(xml);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@
import org.bouncycastle.jce.ECNamedCurveTable;
import org.bouncycastle.jce.spec.ECNamedCurveParameterSpec;
import org.eclipse.fordiac.ide.deployment.exceptions.DeploymentException;
import com.asti.fordiac.ide.deployment.uao.Messages;
import org.eclipse.fordiac.ide.ui.FordiacLogHelper;
import org.eclipse.fordiac.ide.deployment.Activator;
import org.w3c.dom.Document;

import com.asti.fordiac.ide.deployment.uao.Messages;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
Expand Down Expand Up @@ -612,7 +612,7 @@ public void onTextMessage(final WebSocket websocket, final String text) {

@Override
public void onError(final WebSocket websocket, final WebSocketException cause) {
FordiacLogHelper.logError("UAOClient | Error:" + cause.getMessage()); //$NON-NLS-1$
Activator.getDefault().logError("UAOClient | Error:" + cause.getMessage()); //$NON-NLS-1$
}
});
return (websock);
Expand Down Expand Up @@ -667,7 +667,8 @@ private Cipher getCipher(final int mode, final byte[] iv) {
try {
cipher = Cipher.getInstance("AES/CTR/NoPadding", "BC"); //$NON-NLS-1$ //$NON-NLS-2$
} catch (NoSuchAlgorithmException | NoSuchProviderException | NoSuchPaddingException e) {
e.printStackTrace();
Activator.getDefault().logError("Cipher Instance failed. Message: " + e.getMessage()); //$NON-NLS-1$
e.printStackTrace();
} // Dummy Exception catch

final SecretKeySpec key = new SecretKeySpec(sharedSecret, "AES"); //$NON-NLS-1$
Expand All @@ -676,6 +677,7 @@ private Cipher getCipher(final int mode, final byte[] iv) {
try {
cipher.init(mode, key, param);
} catch (InvalidKeyException | InvalidAlgorithmParameterException e) {
Activator.getDefault().logError("Cipher Initialization failed. Message: " + e.getMessage()); //$NON-NLS-1$
e.printStackTrace();
} // Dummy Exception catch
}
Expand Down
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.asti</groupId>
<artifactId>parent</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>2.1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
<tycho-version>4.0.6</tycho-version>
<tycho-repo.url>https://download.eclipse.org/releases/2024-03</tycho-repo.url>
<tycho-version>2.7.5</tycho-version>
<tycho-repo.url>https://download.eclipse.org/releases/2021-06</tycho-repo.url>
<tycho.scmUrl>scm:git:https://github.com/Aimirim-STI/UAORT-4diac-plugin.git</tycho.scmUrl>
<target-config>target-platform</target-config>
<org.eclipse.justj.jre.repository>https://download.eclipse.org/justj/jres/21/updates/release/latest</org.eclipse.justj.jre.repository>
<org.eclipse.justj.jre.repository>https://download.eclipse.org/justj/jres/16/updates/release/16.0.2</org.eclipse.justj.jre.repository>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
</properties>

<repositories>
Expand Down Expand Up @@ -164,4 +164,4 @@
</properties>
</profile>
</profiles>
</project>
</project>
4 changes: 2 additions & 2 deletions target-platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.asti</groupId>
<artifactId>parent</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>2.1.0-SNAPSHOT</version>
</parent>
<packaging>eclipse-target-definition</packaging>
</project>
</project>
Loading

0 comments on commit 76ab7c3

Please sign in to comment.