You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cg...@apache.org on 2023/08/29 04:09:06 UTC
[plc4x] branch feature/merlot updated: Refactoring the creation of devices and assignment of native drivers.
This is an automated email from the ASF dual-hosted git repository.
cgarcia pushed a commit to branch feature/merlot
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/feature/merlot by this push:
new d10d1ce599 Refactoring the creation of devices and assignment of native drivers.
d10d1ce599 is described below
commit d10d1ce599e74e0a4cff6a8aad1dd4d2fba3d2b0
Author: Cesar Garcia <ce...@ceos.com.ve>
AuthorDate: Tue Aug 29 00:07:50 2023 -0400
Refactoring the creation of devices and assignment of native drivers.
---
.../java/bacnetip/readwrite/BACnetVendorId.java | 4 +-
.../java/knxnetip/readwrite/KnxManufacturer.java | 6 +-
.../pom.xml | 35 +-
.../main/java/org/apache/plc4x/dummy/Comando.java | 34 +
.../java/org/apache/plc4x/dummy/MyService.java | 23 +
.../java/org/apache/plc4x/dummy/MyServiceImpl.java | 25 +
.../resources/OSGI-INF/blueprint/my-service.xml} | 7 +-
.../apache/karaf/branding/branding-ssh.properties | 5 +-
.../org/apache/karaf/branding/branding.properties | 5 +-
.../org.apache.plc4x.merlot.das.api/pom.xml | 34 +-
.../merlot/{das => }/api/ByteBasedDriver.java | 2 +-
.../apache/plc4x/merlot/{das => }/api/Driver.java | 6 +-
.../plc4x/merlot/{das => }/api/DriverCallback.java | 2 +-
.../plc4x/merlot/{das => }/api/DriverEvent.java | 4 +-
.../merlot/{das => }/api/MessageBasedDriver.java | 2 +-
.../plc4x/merlot/{das => }/api/Optimizer.java | 2 +-
.../TagBasedDriver.java => api/PlcChannel.java} | 9 +-
.../org/apache/plc4x/merlot/api/PlcDevice.java | 78 ++
.../apache/plc4x/merlot/api/PlcDeviceFactory.java} | 9 +-
.../java/org/apache/plc4x/merlot/api/PlcGroup.java | 75 ++
.../java/org/apache/plc4x/merlot/api/PlcItem.java | 78 ++
.../apache/plc4x/merlot/api/PlcItemListener.java} | 12 +-
.../plc4x/merlot/{das => }/api/TagBasedDriver.java | 2 +-
.../merlot/api/command/ListPlcDriverCommand.java} | 42 +-
.../plc4x/merlot/{das => api}/core/Merlot.java | 2 +-
.../{das => api}/impl/DriverEventFactoryImpl.java | 2 +-
.../merlot/{das => api}/impl/DriverEventImpl.java | 8 +-
.../impl/DriverSessionFactoryImpl.java | 2 +-
.../{das => api}/impl/DriverThreadFactoryImpl.java | 2 +-
.../merlot/api/impl/PlcDeviceFactoryImpl.java | 40 +
.../plc4x/merlot/api/impl/PlcDeviceImpl.java | 333 +++++++++
.../api/impl/PlcDriverAdminServiceImpl.java} | 46 +-
.../apache/plc4x/merlot/api/impl/PlcGroupImpl.java | 291 ++++++++
.../apache/plc4x/merlot/api/impl/PlcItemImpl.java | 375 ++++++++++
.../org/apache/plc4x/merlot/das/api/Device.java | 56 --
.../resources/OSGI-INF/blueprint/api-service.xml | 56 ++
.../org.apache.plc4x.merlot.das.base/pom.xml | 81 ++-
.../cfg/org.apache.plc4x.merlot.das.devices.cfg | 2 +-
.../plc4x/merlot/das/base/api/BaseDevice.java | 33 +-
.../plc4x/merlot/das/base/api/BaseDeviceEvent.java | 28 -
.../merlot/das/base/api/BaseDeviceFactory.java | 31 +-
.../plc4x/merlot/das/base/api/BaseDriver.java | 28 +-
.../plc4x/merlot/das/base/api/BaseDriverMBean.java | 26 +-
.../plc4x/merlot/das/base/api/BaseOptimizer.java | 27 -
.../das/base/command/BasePLCStatusCommand.java | 35 -
.../merlot/das/base/command/BaseReadCommand.java | 35 -
.../merlot/das/base/command/BaseWriteCommand.java | 35 -
.../plc4x/merlot/das/base/command/DemoCommand.java | 69 ++
.../merlot/das/base/command/DeviceNewCommand.java | 98 +++
.../merlot/das/base/command/cmdDeviceDel.java | 76 ++
.../merlot/das/base/command/cmdDeviceGroupDel.java | 33 +
.../das/base/command/cmdDeviceGroupItemDel.java | 22 +
.../das/base/command/cmdDeviceGroupItemList.java | 22 +
.../das/base/command/cmdDeviceGroupItemNew.java | 22 +
.../das/base/command/cmdDeviceGroupList.java | 42 ++
.../merlot/das/base/command/cmdDeviceGroupNew.java | 79 ++
.../das/base/command/cmdDeviceGroupSchedule.java | 70 ++
.../merlot/das/base/command/cmdDeviceList.java | 47 ++
.../merlot/das/base/command/cmdDriverList.java | 48 ++
.../das/base/core/BaseDeviceEventHandler.java | 33 -
.../das/base/core/BaseDeviceManagedService.java | 173 +++--
.../merlot/das/base/core/BaseDriverEvent.java | 196 -----
.../merlot/das/base/impl/BaseDasDriverImpl.java | 104 ---
.../das/base/impl/BaseDeviceFactoryImpl.java | 43 ++
.../plc4x/merlot/das/base/impl/BaseDeviceImpl.java | 388 ++++++----
.../plc4x/merlot/das/base/impl/BaseDriverImpl.java | 523 --------------
.../merlot/das/base/impl/BaseDriverMBeanImpl.java | 24 +-
.../merlot/das/base/impl/BaseFunctionImpl.java | 78 ++
.../plc4x/merlot/das/base/impl/BaseGroupImpl.java | 184 +++++
.../plc4x/merlot/das/base/impl/BaseItemImpl.java | 209 ++++++
.../merlot/das/base/impl/BaseOptimizerImpl.java | 70 --
.../resources/OSGI-INF/blueprint/base-service.xml | 64 ++
.../OSGI-INF/blueprint/basedevice-service.xml | 67 --
.../src/main/resources/OSGI-INF/bundle.info | 37 -
.../pom.xml | 38 +-
.../apache/plc4x/merlot/das/ref/api/MyService.java | 23 +
.../plc4x/merlot/das/ref/api/MyServiceImpl.java | 25 +
.../das/ref/impl/Plc4xReferringDriverImpl.java | 97 +++
.../OSGI-INF/blueprint/referring-drv-service.xml | 42 ++
.../org.apache.plc4x.merlot.das/pom.xml | 10 +
.../plc4x/merlot/das/impl/DeviceManagerImpl.java | 1 -
.../merlot/das/impl/WhiteBoardHandlerImpl.java | 17 +-
.../org.apache.plc4x.merlot.db/pom.xml | 20 +-
.../apache/plc4x/merlot/db/api/DBCollector.java | 2 +-
.../merlot/db/core/DBRecordsManagedService.java | 4 +-
.../plc4x/merlot/db/impl/DBCollectorImpl.java | 6 +-
.../pom.xml | 32 +-
.../plc4x/merlot/derby/api/DerbyService.java | 25 +
.../plc4x/merlot/derby/impl/DerbyServiceImpl.java | 49 ++
.../OSGI-INF/blueprint/derby-svr-service.xml | 42 ++
.../pom.xml | 30 +-
.../plc4x/merlot/drv/simulated/api/MyService.java | 23 +
.../merlot/drv/simulated/api/MyServiceImpl.java | 25 +
.../impl/SimulatedReferringDriverImpl.java | 68 ++
.../OSGI-INF/blueprint/simulated-drv--service.xml | 47 ++
.../src/main/feature/feature.xml | 230 +++++-
.../pom.xml | 33 +-
.../java/org/apache/plc4x/merlot/h2/MyService.java | 23 +
.../org/apache/plc4x/merlot/h2/MyServiceImpl.java | 25 +
.../OSGI-INF/blueprint/h2-svr-service.xml} | 66 +-
.../org.apache.plc4x.merlot.scheduler/pom.xml | 2 +-
.../scheduler/impl/SchedulerWhiteBoardImpl.java | 1 -
.../plc4x/merlot/uns/core/ModelManagedService.java | 5 +-
.../resources/OSGI-INF/blueprint/uns-service.xml | 62 --
plc4j/integrations/plc4j-apache-karaf/pom.xml | 803 +++++++++++++++++++--
pom.xml | 2 +
src/site/asciidoc/images/s7h_image01.png | Bin 0 -> 13527 bytes
src/site/asciidoc/images/s7h_image02.png | Bin 0 -> 40467 bytes
src/site/asciidoc/images/s7h_image03.png | Bin 0 -> 40472 bytes
src/site/asciidoc/images/s7h_image04.png | Bin 0 -> 31906 bytes
src/site/asciidoc/images/s7h_image05.png | Bin 0 -> 31155 bytes
src/site/asciidoc/images/s7h_image06.png | Bin 0 -> 91548 bytes
src/site/asciidoc/images/s7h_image07.png | Bin 0 -> 13557 bytes
src/site/asciidoc/images/s7h_szlxy11demo.png | Bin 0 -> 28698 bytes
114 files changed, 4781 insertions(+), 1993 deletions(-)
diff --git a/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/BACnetVendorId.java b/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/BACnetVendorId.java
index a3c476d7ce..e562b79c6b 100644
--- a/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/BACnetVendorId.java
+++ b/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/BACnetVendorId.java
@@ -357,7 +357,7 @@ public enum BACnetVendorId {
HITRANSE_TECHNOLOGY_COLTD((int) 281, (int) 281, (String) "Hitranse Technology Co., LTD"),
VIGILENT_CORPORATION((int) 282, (int) 282, (String) "Vigilent Corporation"),
KELE_INC((int) 283, (int) 283, (String) "Kele, Inc."),
- OPERA_ELECTRONICS_INC((int) 284, (int) 284, (String) "Opera Electronics, Inc."),
+ BELIMO_AUTOMATIONAG((int) 284, (int) 284, (String) "BELIMO Automation AG"),
GENTEC((int) 285, (int) 285, (String) "Gentec"),
EMBEDDED_SCIENCE_LABSLLC((int) 286, (int) 286, (String) "Embedded Science Labs, LLC"),
PARKER_HANNIFIN_CORPORATION((int) 287, (int) 287, (String) "Parker Hannifin Corporation"),
@@ -511,7 +511,7 @@ public enum BACnetVendorId {
INNCOM_INTERNATIONAL_INC((int) 420, (int) 420, (String) "INNCOM International, Inc."),
METZCONNECT_GMBH((int) 421, (int) 421, (String) "METZ CONNECT GmbH"),
GREENTROL_AUTOMATION_INC((int) 422, (int) 422, (String) "Greentrol Automation, Inc"),
- BELIMO_AUTOMATIONAG((int) 423, (int) 423, (String) "BELIMO Automation AG"),
+ BELIMO_AUTOMATIONAG1((int) 423, (int) 423, (String) "BELIMO Automation AG"),
SAMSUNG_HEAVY_INDUSTRIES_CO_LTD(
(int) 424, (int) 424, (String) "Samsung Heavy Industries Co, Ltd"),
TRIACTA_POWER_TECHNOLOGIES_INC((int) 425, (int) 425, (String) "Triacta Power Technologies, Inc."),
diff --git a/plc4j/drivers/knxnetip/src/main/generated/org/apache/plc4x/java/knxnetip/readwrite/KnxManufacturer.java b/plc4j/drivers/knxnetip/src/main/generated/org/apache/plc4x/java/knxnetip/readwrite/KnxManufacturer.java
index 14fdf1fb38..fa9b0ca5cc 100644
--- a/plc4j/drivers/knxnetip/src/main/generated/org/apache/plc4x/java/knxnetip/readwrite/KnxManufacturer.java
+++ b/plc4j/drivers/knxnetip/src/main/generated/org/apache/plc4x/java/knxnetip/readwrite/KnxManufacturer.java
@@ -736,9 +736,11 @@ public enum KnxManufacturer {
(int) 638, (int) 696, (String) "Shenzhen EastKame Technology Co., Ltd."),
M_BOLATU((int) 639, (int) 697, (String) "BOLATU"),
M_RECBER_KABLO_A_S_((int) 640, (int) 698, (String) "RECBER KABLO A.S."),
- M_ABB___RESERVED((int) 641, (int) 43954, (String) "ABB - reserved"),
+ M_ILITE_KNX((int) 641, (int) 699, (String) "ILite-Knx"),
+ M_LAZZEN((int) 642, (int) 700, (String) "LAZZEN"),
+ M_ABB___RESERVED((int) 643, (int) 43954, (String) "ABB - reserved"),
M_BUSCH_JAEGER_ELEKTRO___RESERVED(
- (int) 642, (int) 43959, (String) "Busch-Jaeger Elektro - reserved");
+ (int) 644, (int) 43959, (String) "Busch-Jaeger Elektro - reserved");
private static final Map<Integer, KnxManufacturer> map;
static {
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/pom.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.dummy/pom.xml
similarity index 74%
copy from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/pom.xml
copy to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.dummy/pom.xml
index 1e1eb98008..d4838949c4 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/pom.xml
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.dummy/pom.xml
@@ -26,13 +26,13 @@
<version>0.11.0-SNAPSHOT</version>
</parent>
- <groupId>org.apache.plc4x.merlot.das.api</groupId>
- <artifactId>org.apache.plc4x.merlot.das.api</artifactId>
+ <groupId>org.apache.plc4x.dummy</groupId>
+ <artifactId>org.apache.plc4x.dummy</artifactId>
<version>0.11.0-SNAPSHOT</version>
<packaging>bundle</packaging>
- <name>PLC4J: Merlot :: api :: OSGi Device access</name>
- <description>org.apache.plc4x.merlot.das.api OSGi blueprint bundle project.</description>
+ <name>org.apache.plc4x.dummy Blueprint Bundle</name>
+ <description>org.apache.plc4x.dummy OSGi blueprint bundle project.</description>
<build>
<plugins>
@@ -45,8 +45,9 @@
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
- <Export-Package>org.apache.plc4x.merlot.das.api*;version=${project.version}</Export-Package>
+ <Export-Package>org.apache.plc4x.dummy*;version=${project.version}</Export-Package>
<Import-Package>*</Import-Package>
+ <Karaf-Commands>org.apache.plc4x.dummy*</Karaf-Commands>
</instructions>
</configuration>
</plugin>
@@ -63,24 +64,24 @@
</build>
<dependencies>
<dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-buffer</artifactId>
- <version>${netty.version}</version>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.cmpn</artifactId>
+ <version>${osgi.cmpn.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-api</artifactId>
- <version>0.11.0-SNAPSHOT</version>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.core</artifactId>
+ <version>${osgi.core.version}</version>
</dependency>
<dependency>
- <groupId>org.osgi</groupId>
- <artifactId>osgi.cmpn</artifactId>
- <version>${osgi.cmpn.version}</version>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.core</artifactId>
+ <version>${karaf.version}</version>
</dependency>
<dependency>
- <groupId>com.lmax</groupId>
- <artifactId>disruptor</artifactId>
- <version>${disruptor.version}</version>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.console</artifactId>
+ <version>${karaf.version}</version>
</dependency>
</dependencies>
</project>
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.dummy/src/main/java/org/apache/plc4x/dummy/Comando.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.dummy/src/main/java/org/apache/plc4x/dummy/Comando.java
new file mode 100644
index 0000000000..cfdace90d4
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.dummy/src/main/java/org/apache/plc4x/dummy/Comando.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.dummy;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+
+
+@Command(scope = "dummy", name = "new", description = "Command for test.")
+@Service
+public class Comando implements Action{
+
+ @Override
+ public Object execute() throws Exception {
+ System.out.println("Ejecuto comando...");
+ return null;
+ }
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.dummy/src/main/java/org/apache/plc4x/dummy/MyService.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.dummy/src/main/java/org/apache/plc4x/dummy/MyService.java
new file mode 100644
index 0000000000..8afdd2f8fe
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.dummy/src/main/java/org/apache/plc4x/dummy/MyService.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.dummy;
+
+public interface MyService {
+
+ public String echo(String message);
+
+}
\ No newline at end of file
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.dummy/src/main/java/org/apache/plc4x/dummy/MyServiceImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.dummy/src/main/java/org/apache/plc4x/dummy/MyServiceImpl.java
new file mode 100644
index 0000000000..42f3f73238
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.dummy/src/main/java/org/apache/plc4x/dummy/MyServiceImpl.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.dummy;
+
+public class MyServiceImpl implements MyService {
+
+ public String echo(String message) {
+ return "Echo processed: " + message;
+ }
+
+}
\ No newline at end of file
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/resources/OSGI-INF/blueprint/das-service.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.dummy/src/main/resources/OSGI-INF/blueprint/my-service.xml
similarity index 76%
rename from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/resources/OSGI-INF/blueprint/das-service.xml
rename to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.dummy/src/main/resources/OSGI-INF/blueprint/my-service.xml
index d699596a27..b8e10ef13f 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/resources/OSGI-INF/blueprint/das-service.xml
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.dummy/src/main/resources/OSGI-INF/blueprint/my-service.xml
@@ -15,7 +15,10 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
+
+ <bean id="serviceBean" class="org.apache.plc4x.dummy.MyServiceImpl"/>
+
+ <service ref="serviceBean" interface="org.apache.plc4x.dummy.MyService"/>
-
</blueprint>
\ No newline at end of file
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.branding/src/main/resources/org/apache/karaf/branding/branding-ssh.properties b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.branding/src/main/resources/org/apache/karaf/branding/branding-ssh.properties
index 580778af9d..19aef77e9b 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.branding/src/main/resources/org/apache/karaf/branding/branding-ssh.properties
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.branding/src/main/resources/org/apache/karaf/branding/branding-ssh.properties
@@ -1,7 +1,4 @@
##
-## Copyright 2019 C\u00e9sar Garc\u00eda
-## cesar.garcia@ceos.com.ve
-##
## Licensed to the Apache Software Foundation (ASF) under one
## or more contributor license agreements. See the NOTICE file
## distributed with this work for additional information
@@ -27,7 +24,7 @@ welcome = \
\u001B[36m | | | | | __/ | | | | | (_) | | |_ \u001B[0m\r\n\
\u001B[36m |_| |_| \\___| |_| |_| \\___/ \\__| \u001B[0m\r\n\
\r\n\
-\u001B[33m Merlot \u001B[34mIndustrial \u001B[31mGateway\u001B[0m (${project.version})\r\n\
+\u001B[33m Plc4x-Merlot \u001B[34mIndustrial \u001B[31mGateway\u001B[0m \r\n\
\r\n\
Hit '\u001B[1m<tab>\u001B[0m' for a list of available commands\r\n\
and '\u001B[1m[cmd] --help\u001B[0m' for help on a specific command.\r\n\
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.branding/src/main/resources/org/apache/karaf/branding/branding.properties b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.branding/src/main/resources/org/apache/karaf/branding/branding.properties
index 601c4b7a47..5de53dfa1c 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.branding/src/main/resources/org/apache/karaf/branding/branding.properties
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.branding/src/main/resources/org/apache/karaf/branding/branding.properties
@@ -1,7 +1,4 @@
##
-## Copyright 2019 C\u00e9sar Garc\u00eda
-## cesar.garcia@ceos.com.ve
-##
## Licensed to the Apache Software Foundation (ASF) under one
## or more contributor license agreements. See the NOTICE file
## distributed with this work for additional information
@@ -27,7 +24,7 @@ welcome = \
\u001B[36m | | | | | __/ | | | | | (_) | | |_ \u001B[0m\r\n\
\u001B[36m |_| |_| \\___| |_| |_| \\___/ \\__| \u001B[0m\r\n\
\r\n\
-\u001B[33m Merlot \u001B[34mIndustrial \u001B[31mGateway\u001B[0m (${project.version})\r\n\
+\u001B[33m Plc4x-Merlot \u001B[34mIndustrial \u001B[31mGateway\u001B[0m \r\n\
\r\n\
Hit '\u001B[1m<tab>\u001B[0m' for a list of available commands\r\n\
and '\u001B[1m[cmd] --help\u001B[0m' for help on a specific command.\r\n\
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/pom.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/pom.xml
index 1e1eb98008..19f26bdd28 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/pom.xml
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/pom.xml
@@ -26,13 +26,13 @@
<version>0.11.0-SNAPSHOT</version>
</parent>
- <groupId>org.apache.plc4x.merlot.das.api</groupId>
- <artifactId>org.apache.plc4x.merlot.das.api</artifactId>
+ <groupId>org.apache.plc4x.merlot.api</groupId>
+ <artifactId>org.apache.plc4x.merlot.api</artifactId>
<version>0.11.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>PLC4J: Merlot :: api :: OSGi Device access</name>
- <description>org.apache.plc4x.merlot.das.api OSGi blueprint bundle project.</description>
+ <description>org.apache.plc4x.merlot.api OSGi blueprint bundle project.</description>
<build>
<plugins>
@@ -45,8 +45,9 @@
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
- <Export-Package>org.apache.plc4x.merlot.das.api*;version=${project.version}</Export-Package>
+ <Export-Package>org.apache.plc4x.merlot.api*;version=${project.version}</Export-Package>
<Import-Package>*</Import-Package>
+ <Karaf-Commands>org.apache.plc4x.merlot.api.command*</Karaf-Commands>
</instructions>
</configuration>
</plugin>
@@ -82,5 +83,30 @@
<artifactId>disruptor</artifactId>
<version>${disruptor.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.dal</artifactId>
+ <version>1.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.plc4x.merlot.scheduler</groupId>
+ <artifactId>org.apache.plc4x.merlot.scheduler</artifactId>
+ <version>0.11.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.core</artifactId>
+ <version>${osgi.core.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.util</artifactId>
+ <version>${karaf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.core</artifactId>
+ <version>${karaf.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/ByteBasedDriver.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/ByteBasedDriver.java
similarity index 99%
rename from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/ByteBasedDriver.java
rename to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/ByteBasedDriver.java
index f27180bddc..dff0bbd13d 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/ByteBasedDriver.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/ByteBasedDriver.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.plc4x.merlot.das.api;
+package org.apache.plc4x.merlot.api;
import io.netty.buffer.ByteBuf;
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/Driver.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/Driver.java
similarity index 94%
rename from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/Driver.java
rename to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/Driver.java
index 9873fce209..4242fbcfa3 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/Driver.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/Driver.java
@@ -16,10 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.plc4x.merlot.das.api;
+package org.apache.plc4x.merlot.api;
-import org.apache.plc4x.merlot.das.core.Merlot;
-import org.apache.plc4x.merlot.das.core.Merlot.STATE;
+import org.apache.plc4x.merlot.api.core.Merlot;
+import org.apache.plc4x.merlot.api.core.Merlot.STATE;
import java.time.LocalDateTime;
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/DriverCallback.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/DriverCallback.java
similarity index 95%
rename from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/DriverCallback.java
rename to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/DriverCallback.java
index 3e14acaa70..88b7dbc4af 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/DriverCallback.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/DriverCallback.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.plc4x.merlot.das.api;
+package org.apache.plc4x.merlot.api;
public interface DriverCallback {
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/DriverEvent.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/DriverEvent.java
similarity index 96%
rename from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/DriverEvent.java
rename to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/DriverEvent.java
index 14a436bbd4..206661e3c5 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/DriverEvent.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/DriverEvent.java
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.plc4x.merlot.das.api;
+package org.apache.plc4x.merlot.api;
-import org.apache.plc4x.merlot.das.core.Merlot.FUNCTION;
+import org.apache.plc4x.merlot.api.core.Merlot.FUNCTION;
import io.netty.buffer.ByteBuf;
import org.apache.plc4x.java.api.messages.PlcReadRequest;
import org.apache.plc4x.java.api.messages.PlcReadResponse;
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/MessageBasedDriver.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/MessageBasedDriver.java
similarity index 95%
rename from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/MessageBasedDriver.java
rename to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/MessageBasedDriver.java
index 83c520ce1d..d3e1442b75 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/MessageBasedDriver.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/MessageBasedDriver.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.plc4x.merlot.das.api;
+package org.apache.plc4x.merlot.api;
public interface MessageBasedDriver extends Driver{
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/Optimizer.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/Optimizer.java
similarity index 96%
rename from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/Optimizer.java
rename to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/Optimizer.java
index 2742262249..4dc6cb88d9 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/Optimizer.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/Optimizer.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.plc4x.merlot.das.api;
+package org.apache.plc4x.merlot.api;
public interface Optimizer {
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/TagBasedDriver.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/PlcChannel.java
similarity index 85%
copy from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/TagBasedDriver.java
copy to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/PlcChannel.java
index 76d7d8f833..8a7d48b077 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/TagBasedDriver.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/PlcChannel.java
@@ -16,9 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.plc4x.merlot.das.api;
+package org.apache.plc4x.merlot.api;
-public interface TagBasedDriver extends Driver{
-
+public interface PlcChannel {
+
+ public void activate();
+ public void deactivate();
+
}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/PlcDevice.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/PlcDevice.java
new file mode 100644
index 0000000000..353f0633bf
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/PlcDevice.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * https://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.apache.plc4x.merlot.api;
+
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.plc4x.java.api.PlcDriver;
+
+
+public interface PlcDevice extends org.osgi.service.device.Device, org.osgi.service.dal.Device {
+
+ public void init() throws Exception;
+ public void destroy() throws Exception;
+
+ public void start();
+ public void stop();
+
+ public Hashtable<String, ?> getProperties();
+
+ public String getDeviceName();
+ public void setDeviceName(String groupname);
+
+ public String getDeviceDescription();
+ public void setDeviceDescription(String groupdescription);
+
+ public void setUid(UUID uid);
+ public UUID getUid();
+
+ public boolean isEnable();
+ public void setEnable(boolean enable);
+
+ public void setUrl(String url);
+ public String getUrl();
+
+ public void attach(PlcDriver driver);
+
+ public void putGroup(PlcGroup group);
+ public PlcGroup getGroup(UUID uid);
+ public void removeGroup(UUID uid);
+ public List<PlcGroup> getGroups();
+
+// public DriverEvent getEvent();
+//
+// public void putEvent(DriverEvent event);
+//
+// public void doEvent(DriverEvent event, String tag);
+//
+// public void ReadRequest(String index, String id, DriverCallback cb);
+//
+// public void WriteRequest(String scalar, String id, List<String> values, DriverCallback cb);
+//
+// public void SubscriptionRequest(String... events);
+//
+// public void UnsubscriptionRequest(String... events);
+//
+// public void ConsumerRegister(String event, Consumer<PlcSubscriptionEvent> consumer);
+//
+// public void ConsumerUnRegister(String event);
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDeviceFactory.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/PlcDeviceFactory.java
similarity index 81%
copy from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDeviceFactory.java
copy to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/PlcDeviceFactory.java
index 82c13b9948..9bf5242b52 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDeviceFactory.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/PlcDeviceFactory.java
@@ -16,11 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.plc4x.merlot.das.base.api;
+package org.apache.plc4x.merlot.api;
-public interface BaseDeviceFactory {
+public interface PlcDeviceFactory {
- public BaseDevice create(String serial, String url, String description);
+ /*
+ *
+ */
+ public PlcDevice create(String device, String url, String name, String description);
}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/PlcGroup.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/PlcGroup.java
new file mode 100644
index 0000000000..346201ea96
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/PlcGroup.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * https://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.apache.plc4x.merlot.api;
+
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+
+public interface PlcGroup {
+
+ public static final String GROUP_DEVICE_UID = "DEVICE_UID";
+
+ public static final String GROUP_UID = "plc4x.group.uid";
+
+ public static final String GROUP_NAME = "scheduler.name";
+
+ public static final String GROUP_DESCRIPTION = "plc4x.group.description";
+
+ public static final String GROUP_PERIOD = "scheduler.period";
+
+ public static final String GROUP_IMMEDIATE = "scheduler.immediate";
+
+ public static final String GROUP_CONCURRENT = "scheduler.concurrent";
+
+
+
+ public UUID getGroupUid();
+
+ public String getGroupName();
+ public void setGroupName(String groupname);
+
+ public String getGroupDescription();
+ public void setGroupDescription(String groupdescription);
+
+ public boolean isEnable();
+ public void setEnable(boolean enable);
+
+ public long getPeriod();
+ public void setPeriod(long scantime);
+
+ public long getGroupTransmit();
+
+ public long getGroupReceives();
+
+ public long getGroupErrors();
+
+ public Map<UUID, PlcItem> getGroupItems();
+ public void setGroupItems(long groupitems);
+
+ public Hashtable<String, Object> getProperties();
+
+ public void putItem(PlcItem item);
+ public PlcItem getItem(UUID itemkey);
+ public void removeItem(UUID itemkey);
+ public List<PlcItem> getItems();
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/PlcItem.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/PlcItem.java
new file mode 100644
index 0000000000..4e39cce5f4
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/PlcItem.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * https://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.apache.plc4x.merlot.api;
+
+import io.netty.buffer.ByteBuf;
+import java.util.Collection;
+import java.util.Date;
+import java.util.UUID;
+import org.apache.plc4x.java.api.messages.PlcReadResponse;
+import org.apache.plc4x.java.api.model.PlcTag;
+import org.apache.plc4x.java.api.types.PlcResponseCode;
+
+public interface PlcItem {
+
+ public static final String ITEM_UID = "plc4x.item.uid";
+
+ public UUID getItemUid();
+
+ public String getItemName();
+ public void setItemName(String itemname);
+
+ public String getItemDescription();
+ public void setItemDescription(String itemdescription);
+
+ public String getItemId();
+ public void setItemId(String itemid);
+
+ public PlcTag getItemPlcTag();
+ public void setItemPlcTag(PlcTag itemplctag);
+
+ public Boolean getIsEnable();
+ public void setIsEnable(Boolean enable);
+
+ public Boolean getIsArray();
+ public void setIsArray(Boolean isArray);
+
+ public Boolean getIsDisableOutput();
+ public void setIsDisableOutput(Boolean isDisableOutput);
+
+ public long getItemTransmits();
+ public long getItemReceives();
+ public long getItemErrors();
+
+ public int getAccessRights();
+ public void setAccessRights(int accessrigths);
+
+ public PlcResponseCode getDataQuality();
+ public void setDataQuality(PlcResponseCode dataquality);
+
+ public void setPlcValues(PlcReadResponse plcresponse);
+ public Collection<Object> getPlcValues();
+
+ public ByteBuf getItemBuffer();
+
+ public void addItemClient(PlcItemListener client);
+ public void removeItemClient(PlcItemListener client);
+
+ public Date getLastReadDate();
+ public Date getLastWriteDate();
+ public Date getLastErrorDate();
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDeviceFactory.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/PlcItemListener.java
similarity index 80%
copy from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDeviceFactory.java
copy to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/PlcItemListener.java
index 82c13b9948..8ad18043fe 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDeviceFactory.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/PlcItemListener.java
@@ -16,11 +16,17 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.plc4x.merlot.das.base.api;
+package org.apache.plc4x.merlot.api;
+import io.netty.buffer.ByteBuf;
-public interface BaseDeviceFactory {
+
+public interface PlcItemListener {
+
+ void atach(final PlcItem plcitem);
+
+ void detach();
- public BaseDevice create(String serial, String url, String description);
+ void update();
}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/TagBasedDriver.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/TagBasedDriver.java
similarity index 95%
rename from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/TagBasedDriver.java
rename to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/TagBasedDriver.java
index 76d7d8f833..33696662c0 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/TagBasedDriver.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/TagBasedDriver.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.plc4x.merlot.das.api;
+package org.apache.plc4x.merlot.api;
public interface TagBasedDriver extends Driver{
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/BaseDriverCommand.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/command/ListPlcDriverCommand.java
similarity index 56%
rename from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/BaseDriverCommand.java
rename to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/command/ListPlcDriverCommand.java
index 0ac4a11fdc..5204ddfa29 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/BaseDriverCommand.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/command/ListPlcDriverCommand.java
@@ -16,36 +16,34 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.plc4x.merlot.das.base.command;
+package org.apache.plc4x.merlot.api.command;
+import java.util.List;
import org.apache.karaf.shell.api.action.Action;
import org.apache.karaf.shell.api.action.Command;
import org.apache.karaf.shell.api.action.lifecycle.Reference;
import org.apache.karaf.shell.api.action.lifecycle.Service;
-import org.osgi.framework.BundleContext;
-import org.apache.plc4x.merlot.das.base.api.BaseDriver;
+import org.apache.karaf.shell.support.table.ShellTable;
+import org.apache.plc4x.java.api.PlcDriver;
+import org.apache.plc4x.merlot.api.impl.PlcDriverAdminServiceImpl;
-
-@Command(scope = "basic", name = "test", description = "Command for test.")
+@Command(scope = "plc4x", name = "driver-list", description = "List all channels")
@Service
-public class BaseDriverCommand implements Action {
-
- @Reference
- BundleContext bundleContext;
+public class ListPlcDriverCommand implements Action {
@Reference
- BaseDriver theDriver;
+ PlcDriverAdminServiceImpl channels;
+
+ @Override
+ public Object execute() throws Exception {
+ ShellTable table = new ShellTable();
+ table.column("Code");
+ table.column("Name");
+ List<PlcDriver> drivers = channels.getPlcDriverList();
+
+ drivers.forEach(drv -> {table.addRow().addContent(drv.getProtocolCode(), drv.getProtocolName());});
+ table.print(System.out);
+ return null;
+ }
- @Override
- public Object execute() throws Exception {
- // TODO Auto-generated method stub
- System.out.println("Comando de prueba");
- if (theDriver == null) {
- System.out.println("Nose encontro el driver.");
- } {
- //theDriver.InitializeDevice(null);
- };
- return null;
- }
-
}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/core/Merlot.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/core/Merlot.java
similarity index 99%
rename from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/core/Merlot.java
rename to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/core/Merlot.java
index 1b4ff8c4ea..40e122f993 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/core/Merlot.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/core/Merlot.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.plc4x.merlot.das.core;
+package org.apache.plc4x.merlot.api.core;
import java.util.HashMap;
import java.util.Map;
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/impl/DriverEventFactoryImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/DriverEventFactoryImpl.java
similarity index 95%
rename from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/impl/DriverEventFactoryImpl.java
rename to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/DriverEventFactoryImpl.java
index 820e380a07..30666f4869 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/impl/DriverEventFactoryImpl.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/DriverEventFactoryImpl.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.plc4x.merlot.das.impl;
+package org.apache.plc4x.merlot.api.impl;
public class DriverEventFactoryImpl {
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/impl/DriverEventImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/DriverEventImpl.java
similarity index 96%
rename from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/impl/DriverEventImpl.java
rename to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/DriverEventImpl.java
index 55d2f3a5a8..128c95a38e 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/impl/DriverEventImpl.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/DriverEventImpl.java
@@ -16,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.plc4x.merlot.das.impl;
+package org.apache.plc4x.merlot.api.impl;
-import org.apache.plc4x.merlot.das.api.DriverCallback;
-import org.apache.plc4x.merlot.das.api.DriverEvent;
-import org.apache.plc4x.merlot.das.core.Merlot.FUNCTION;
+import org.apache.plc4x.merlot.api.DriverCallback;
+import org.apache.plc4x.merlot.api.DriverEvent;
+import org.apache.plc4x.merlot.api.core.Merlot.FUNCTION;
import com.lmax.disruptor.EventFactory;
import io.netty.buffer.ByteBuf;
import org.apache.plc4x.java.api.messages.PlcReadRequest;
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/impl/DriverSessionFactoryImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/DriverSessionFactoryImpl.java
similarity index 95%
rename from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/impl/DriverSessionFactoryImpl.java
rename to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/DriverSessionFactoryImpl.java
index 353363a730..2474e63b92 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/impl/DriverSessionFactoryImpl.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/DriverSessionFactoryImpl.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.plc4x.merlot.das.impl;
+package org.apache.plc4x.merlot.api.impl;
public class DriverSessionFactoryImpl {
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/impl/DriverThreadFactoryImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/DriverThreadFactoryImpl.java
similarity index 95%
rename from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/impl/DriverThreadFactoryImpl.java
rename to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/DriverThreadFactoryImpl.java
index e01306bf78..fb144aef74 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/impl/DriverThreadFactoryImpl.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/DriverThreadFactoryImpl.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.plc4x.merlot.das.impl;
+package org.apache.plc4x.merlot.api.impl;
import java.util.concurrent.ThreadFactory;
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/PlcDeviceFactoryImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/PlcDeviceFactoryImpl.java
new file mode 100644
index 0000000000..32e29d6101
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/PlcDeviceFactoryImpl.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.api.impl;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.plc4x.merlot.api.PlcDevice;
+import org.apache.plc4x.merlot.api.PlcDeviceFactory;
+import org.osgi.framework.BundleContext;
+
+public class PlcDeviceFactoryImpl implements PlcDeviceFactory {
+ private static final Logger LOGGER = LoggerFactory.getLogger(PlcDeviceFactory.class);
+
+ private final BundleContext bc;
+
+ public PlcDeviceFactoryImpl(BundleContext bc) {
+ this.bc = bc;
+ }
+
+ @Override
+ public PlcDevice create(String device, String url, String name, String description) {
+ return new PlcDeviceImpl.PlcDeviceBuilder(bc, url, name, description).build();
+
+ }
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/PlcDeviceImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/PlcDeviceImpl.java
new file mode 100644
index 0000000000..f7444f00e2
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/PlcDeviceImpl.java
@@ -0,0 +1,333 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.api.impl;
+
+
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.plc4x.java.api.PlcConnection;
+import org.apache.plc4x.java.api.PlcDriver;
+import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
+import org.apache.plc4x.merlot.api.PlcDevice;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.dal.Device;
+import org.osgi.service.dal.DeviceException;
+import org.osgi.service.device.Constants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.plc4x.merlot.api.PlcGroup;
+import org.apache.plc4x.merlot.api.PlcItem;
+import org.apache.plc4x.merlot.scheduler.api.Job;
+import org.osgi.framework.ServiceReference;
+
+ public class PlcDeviceImpl implements PlcDevice {
+ private static final Logger LOGGER = LoggerFactory.getLogger(PlcDeviceImpl.class);
+ private static final String FILTER_DEVICE = "(&(" + org.osgi.framework.Constants.OBJECTCLASS + "=" + PlcDevice.class.getName() + ")" +
+ "(" + PlcDevice.SERVICE_UID + "=*))";
+
+ protected final BundleContext bc;
+ protected boolean enable = false;
+ protected boolean autostart = false;
+ protected UUID uid = null;
+
+ protected String url = null;
+
+ protected PlcDriver plcDriver = null;
+ protected PlcConnection plcConnection = null;
+
+ protected Hashtable<String, Object> myProperties = new Hashtable<String, Object>();
+
+ private final Map<UUID, PlcGroup> device_groups = new HashMap();
+
+ public PlcDeviceImpl(PlcDeviceBuilder builder) {
+ this.bc = builder.bc;
+ myProperties.put(Device.SERVICE_DRIVER, builder.service_driver);
+ myProperties.put(Device.SERVICE_NAME, builder.service_name);
+ myProperties.put(Device.SERVICE_DESCRIPTION, builder.service_description);
+ if (null != builder.service_uid) {
+ myProperties.put(Device.SERVICE_UID, builder.service_uid);
+ } else {
+ myProperties.put(Device.SERVICE_UID, UUID.randomUUID().toString());
+ }
+
+ if (null != builder.device_category) myProperties.put(Constants.DEVICE_CATEGORY, builder.device_category);
+ if (null != builder.service_firmware_vendor) myProperties.put(Device.SERVICE_FIRMWARE_VENDOR, builder.service_firmware_vendor);
+ if (null != builder.service_firmware_version) myProperties.put(Device.SERVICE_FIRMWARE_VERSION, builder.service_firmware_version);
+ if (null != builder.service_hardware_vendor) myProperties.put(Device.SERVICE_HARDWARE_VENDOR, builder.service_hardware_vendor);
+ if (null != builder.service_hardware_version) myProperties.put(Device.SERVICE_HARDWARE_VERSION, builder.service_hardware_version);
+ if (null != builder.service_model) myProperties.put(Device.SERVICE_MODEL, builder.service_model);
+ if (null != builder.service_reference_uids) myProperties.put(Device.SERVICE_REFERENCE_UIDS, builder.service_reference_uids);
+ if (null != builder.service_serial_number) myProperties.put(Device.SERVICE_SERIAL_NUMBER, builder.service_serial_number);
+ if (null != builder.service_status) myProperties.put(Device.SERVICE_STATUS, builder.service_status);
+ if (null != builder.service_status_detail) myProperties.put(Device.SERVICE_STATUS_DETAIL, builder.service_status_detail);
+ if (null != builder.service_types) myProperties.put(Device.SERVICE_TYPES, builder.service_types);
+ }
+
+ @Override
+ public void init() throws Exception {
+ //
+ }
+
+ @Override
+ public void destroy() throws Exception {
+ //
+ }
+
+ @Override
+ public void start() {
+ if (null != plcDriver) {
+ //Try to connect
+ final String url = (String) myProperties.get(Device.SERVICE_DRIVER);
+ try {
+ plcConnection = plcDriver.getConnection(url);
+ enable = true;
+ } catch (PlcConnectionException ex) {
+ LOGGER.info(ex.getLocalizedMessage());
+ enable = false;
+ }
+ }
+ }
+
+ @Override
+ public void stop() {
+ enable = false;
+ try {
+ plcConnection.close();
+ } catch (Exception ex) {
+ LOGGER.info(ex.getLocalizedMessage());
+ }
+ }
+
+ @Override
+ public Hashtable<String, ?> getProperties() {
+ return myProperties;
+ }
+
+
+ @Override
+ public String getDeviceName() {
+ return (String) myProperties.get(Device.SERVICE_NAME);
+ }
+
+ @Override
+ public void setDeviceName(String devicename) {
+ myProperties.put(Device.SERVICE_NAME, devicename);
+ }
+
+ @Override
+ public String getDeviceDescription() {
+ return (String) myProperties.get(Device.SERVICE_DESCRIPTION);
+ }
+
+ @Override
+ public void setDeviceDescription(String devicedescription) {
+ myProperties.put(Device.SERVICE_DESCRIPTION, devicedescription);
+ }
+
+ @Override
+ public void setUid(UUID uid) {
+ this.uid = uid;
+ }
+
+ @Override
+ public UUID getUid() {
+ return uid;
+ }
+
+
+ @Override
+ public boolean isEnable() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void setEnable(boolean enable) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void setUrl(String url) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public String getUrl() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void putGroup(PlcGroup group) {
+ if ((!enable) && (!device_groups.containsKey(group.getGroupUid()))) {
+ device_groups.put(group.getGroupUid(), group);
+ bc.registerService(new String[]{Job.class.getName(),
+ PlcGroup.class.getName()},
+ group,
+ group.getProperties());
+ }
+ device_groups.put(group.getGroupUid(), group);
+ }
+
+ @Override
+ public PlcGroup getGroup(UUID uid) {
+ return device_groups.get(uid);
+ }
+
+ @Override
+ public void removeGroup(UUID uid) {
+ String filter = FILTER_DEVICE.replace("*", uid.toString());
+ ServiceReference<?> sr = bc.getServiceReference(filter);
+ bc.ungetService(sr);
+ device_groups.remove(uid);
+ }
+
+ @Override
+ public List<PlcGroup> getGroups() {
+ return null;
+ }
+
+
+ @Override
+ public void noDriverFound() {
+ LOGGER.info("The associated driver is not found. go to IDLE.");
+ }
+
+ @Override
+ public Object getServiceProperty(String propKey) {
+ return myProperties.get(propKey);
+ }
+
+ @Override
+ public String[] getServicePropertyKeys() {
+ return myProperties.keySet().toArray(new String[myProperties.size()]);
+ }
+
+ @Override
+ public void remove() throws DeviceException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void attach(PlcDriver driver) {
+ LOGGER.info("Device: {} attach to driver {} ", myProperties.get(Device.SERVICE_NAME), driver.getProtocolCode());
+ this.plcDriver = driver;
+ }
+
+
+ public static class PlcDeviceBuilder {
+ private final BundleContext bc;
+ private final String service_name;
+ private final String service_description;
+ private final String service_driver;
+ private String service_uid;
+ private String device_category;
+ private String service_firmware_vendor;
+ private String service_firmware_version;
+ private String service_hardware_vendor;
+ private String service_hardware_version;
+ private String service_model;
+ private String[] service_reference_uids;
+ private String service_serial_number;
+ private String service_status;
+ private String service_status_detail;
+ private String[] service_types;
+
+ public PlcDeviceBuilder(BundleContext bc, String service_driver, String service_name, String service_description) {
+ this.bc = bc;
+ this.service_name = service_name;
+ this.service_description = service_description;
+ this.service_driver = service_driver;
+ String[] drv = service_driver.split(":");
+ this.device_category = drv[0];
+ }
+
+ public PlcDeviceBuilder setServiceUid(String serviceuid) {
+ this.service_uid = serviceuid;
+ return this;
+ }
+
+ public PlcDeviceBuilder setDeviceCategory(String device_category) {
+ this.device_category = device_category;
+ return this;
+ }
+
+ public PlcDeviceBuilder setServiceFirmwareVendor(String service_firmware_vendor) {
+ this.service_firmware_vendor = service_firmware_vendor;
+ return this;
+ }
+
+ public PlcDeviceBuilder setServiceFirmwareVersion(String service_firmware_version) {
+ this.service_firmware_version = service_firmware_version;
+ return this;
+ }
+
+ public PlcDeviceBuilder setServiceHardwareVendor(String service_hardware_vendor) {
+ this.service_hardware_vendor = service_hardware_vendor;
+ return this;
+ }
+
+ public PlcDeviceBuilder setServiceHardwareVersion(String service_hardware_version) {
+ this.service_hardware_version = service_hardware_version;
+ return this;
+ }
+
+ public PlcDeviceBuilder setServiceModel(String service_model) {
+ this.service_model = service_model;
+ return this;
+ }
+
+ public PlcDeviceBuilder setServiceReferenceUids(String[] service_reference_uids) {
+ this.service_reference_uids = service_reference_uids;
+ return this;
+ }
+
+ public PlcDeviceBuilder setServiceSerialNumber(String service_serial_number) {
+ this.service_serial_number = service_serial_number;
+ return this;
+ }
+
+ public PlcDeviceBuilder setServiceStatus(String service_status) {
+ this.service_status = service_status;
+ return this;
+ }
+
+ public PlcDeviceBuilder setServiceStatusDetail(String service_status_detail) {
+ this.service_status_detail = service_status_detail;
+ return this;
+ }
+
+ public PlcDeviceBuilder setServiceTypes(String[] service_types) {
+ this.service_types = service_types;
+ return this;
+ }
+
+
+ public PlcDevice build() {
+ PlcDevice plcdevice = new PlcDeviceImpl(this);
+ validateBaseDeviceObject(plcdevice);
+ return plcdevice;
+ }
+
+ private void validateBaseDeviceObject(PlcDevice plcdevice) {
+ //
+ }
+ }
+
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDriver.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/PlcDriverAdminServiceImpl.java
similarity index 50%
copy from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDriver.java
copy to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/PlcDriverAdminServiceImpl.java
index 277786aff3..30cd22fed2 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDriver.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/PlcDriverAdminServiceImpl.java
@@ -16,25 +16,47 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.plc4x.merlot.das.base.api;
+package org.apache.plc4x.merlot.api.impl;
-import org.apache.plc4x.merlot.das.api.Driver;
-import java.time.LocalDateTime;
-import org.apache.plc4x.java.api.PlcConnection;
+import java.util.List;
import org.apache.plc4x.java.api.PlcDriver;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.event.EventAdmin;
-public interface BaseDriver extends Driver {
-
- public void setBundleContext(BundleContext bundleContext);
+
+public class PlcDriverAdminServiceImpl {
+
+ private BundleContext bc;
+ private final EventAdmin eventAdmin;
+ private List<PlcDriver> drivers = null;
- public void setPlcDriver(PlcDriver plcDriver);
- public PlcDriver getPlcDriver();
+ public PlcDriverAdminServiceImpl(BundleContext bc, EventAdmin eventAdmin) {
+ this.bc = bc;
+ this.eventAdmin = eventAdmin;
+ }
- public PlcConnection getPlcConnection();
+ public void setPlcDriverList(List<PlcDriver> drivers) {
+ this.drivers = drivers;
+ }
+
+ public List<PlcDriver> getPlcDriverList() {
+ return drivers;
+ }
+
+
+ public void bind(ServiceReference reference) {
+ //
+ }
+
+ public void bind(PlcDriver driver){
+ //
+ }
+
+ public void unbind(ServiceReference driver){
+ //
+ }
-
-
}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/PlcGroupImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/PlcGroupImpl.java
new file mode 100644
index 0000000000..42c3efaa3d
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/PlcGroupImpl.java
@@ -0,0 +1,291 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.api.impl;
+
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.plc4x.java.api.PlcConnection;
+import org.apache.plc4x.java.api.messages.PlcReadRequest;
+import org.apache.plc4x.java.api.messages.PlcReadResponse;
+import org.apache.plc4x.java.api.types.PlcResponseCode;
+import org.apache.plc4x.merlot.scheduler.api.Job;
+import org.apache.plc4x.merlot.scheduler.api.JobContext;
+import org.osgi.framework.BundleContext;
+import org.apache.plc4x.merlot.api.PlcItem;
+import org.apache.plc4x.merlot.api.PlcGroup;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.LoggerFactory;
+
+
+public class PlcGroupImpl implements PlcGroup, Job {
+ private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(PlcGroupImpl.class);
+ private static final String FILTER_ITEM = "(&(" + org.osgi.framework.Constants.OBJECTCLASS + "=" + PlcItem.class.getName() + ")" +
+ "(" + PlcItem.ITEM_UID + "=*))";
+
+ protected final BundleContext bc;
+
+ private UUID uid;
+
+ private String groupname;
+ private String groupdescription;
+
+ private boolean enable = false;
+
+ private long period;
+ private long deadband;
+
+ private long grouptransmit = 0;
+ private long groupreceives = 0;
+ private long grouperrors = 0;
+
+ private long groupitems = 0;
+ private long groupupdatrate = -1;
+
+ private final Hashtable<String, Object> myproperties;
+
+ private final Map<UUID, PlcItem> plcitems;
+
+ private PlcConnection plcConnection = null;
+ private PlcReadRequest.Builder builder = null;
+
+ private long[] aux = new long[1];
+
+ public PlcGroupImpl(PlcGroupBuilder builder) {
+ this.bc = builder.bc;
+ this.plcitems = new Hashtable<>();
+ this.myproperties = new Hashtable<>();
+ myproperties.put(PlcGroup.GROUP_NAME, builder.group_name);
+ myproperties.put(PlcGroup.GROUP_CONCURRENT, false);
+ myproperties.put(PlcGroup.GROUP_IMMEDIATE, true);
+ if (null != builder.group_name) myproperties.put(PlcGroup.GROUP_DESCRIPTION, builder.group_name);
+ if (null != builder.group_uid) myproperties.put(PlcGroup.GROUP_UID, builder.group_uid);
+ }
+
+
+ public void start(int bc){
+ //
+ if (null != plcConnection) {
+ if (plcConnection.isConnected()) {
+ enable = true;
+ } else {
+ enable = false;
+ }
+ } else {
+ enable = false;
+ }
+ }
+
+ public void stop(int bc){
+ enable = false;
+ }
+
+ @Override
+ public UUID getGroupUid() {
+ return (UUID) myproperties.get(PlcGroup.GROUP_UID);
+ }
+
+ @Override
+ public String getGroupName() {
+ return (String) myproperties.get(PlcGroup.GROUP_NAME);
+ }
+
+ @Override
+ public void setGroupName(String groupname) {
+ myproperties.put(PlcGroup.GROUP_NAME, groupname);
+ }
+
+ @Override
+ public String getGroupDescription() {
+ return (String) myproperties.get(PlcGroup.GROUP_DESCRIPTION);
+ }
+
+ @Override
+ public void setGroupDescription(String groupdescription) {
+ myproperties.put(PlcGroup.GROUP_DESCRIPTION, groupdescription);
+ }
+
+ @Override
+ public boolean isEnable() {
+ return enable;
+ }
+
+ @Override
+ public void setEnable(boolean enable) {
+ this.enable = enable;
+ }
+
+ @Override
+ public long getPeriod() {
+ return (long) myproperties.get(PlcGroup.GROUP_PERIOD);
+ }
+
+ @Override
+ public void setPeriod(long period) {
+ myproperties.put(PlcGroup.GROUP_PERIOD, (period < 100)?100:period);
+ }
+
+ @Override
+ public long getGroupTransmit() {
+ aux[0] = 0;
+ plcitems.forEach((uid, item) -> {aux[0] = +item.getItemTransmits();});
+ return aux[0];
+ }
+
+ @Override
+ public long getGroupReceives() {
+ aux[0] = 0;
+ plcitems.forEach((uid, item) -> {aux[0] = +item.getItemReceives();});
+ return aux[0];
+ }
+
+ @Override
+ public long getGroupErrors() {
+ aux[0] = 0;
+ plcitems.forEach((uid, item) -> {aux[0] = +item.getItemErrors();});
+ return aux[0];
+ }
+
+ @Override
+ public Map<UUID, PlcItem> getGroupItems() {
+ return plcitems;
+ }
+
+ @Override
+ public void setGroupItems(long groupitems) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Hashtable<String, Object> getProperties() {
+ return myproperties;
+ }
+
+ @Override
+ public void putItem(PlcItem item) {
+ if (!plcitems.containsKey(item)) {
+ plcitems.put(item.getItemUid(), item);
+ Hashtable properties = new Hashtable();
+ properties.putIfAbsent(PlcGroup.GROUP_UID, uid.toString());
+ properties.putIfAbsent(PlcItem.ITEM_UID, item.getItemUid().toString());
+ bc.registerService(PlcItem.class.getName(), item, properties);
+ }
+ }
+
+ @Override
+ public PlcItem getItem(UUID itemuid) {
+ return plcitems.get(itemuid);
+ }
+
+ //TODO: remove from context
+ @Override
+ public void removeItem(UUID itemuid) {
+ String filter = FILTER_ITEM.replace("*", itemuid.toString());
+ ServiceReference<?> sr = bc.getServiceReference(filter);
+ bc.ungetService(sr);
+ plcitems.remove(itemuid);
+ }
+
+ @Override
+ public List<PlcItem> getItems() {
+ return null;
+ }
+
+ @Override
+ public void execute(JobContext context) {
+ if (enable) {
+ System.out.println("Tamaño de la coleccion: " + plcitems.size());
+ }
+ }
+
+ /*
+ * Execute the read function for all items
+ *
+ */
+ private void executeReadAllItems() {
+ //1. The item was
+ builder = plcConnection.readRequestBuilder();
+ plcitems.forEach((u,i) ->{
+ if (i.getIsEnable()) {
+ builder.addTagAddress(u.toString(), i.getItemId());
+ }
+ });
+ PlcReadRequest readRequest = builder.build();
+ try {
+ PlcReadResponse syncResponse = readRequest.execute().get();
+ syncResponse.getTagNames().forEach(s ->{
+ Collection<Object> values = syncResponse.getAllObjects(s);
+ plcitems.get(s).setDataQuality(syncResponse.getResponseCode(s));
+ if (syncResponse.getResponseCode(s) == PlcResponseCode.OK) {
+ plcitems.get(s).setPlcValues(syncResponse);
+ }
+ });
+ } catch (Exception ex) {
+ LOGGER.info(ex.getMessage());
+ }
+ }
+
+ public static class PlcGroupBuilder {
+ protected final BundleContext bc;
+ private final String group_name;
+ private String group_description;
+ private UUID group_uid;
+ private boolean group_enable = false;
+ private long group_period = 100;
+
+ public PlcGroupBuilder(BundleContext bc, String group_name) {
+ this.bc = bc;
+ this.group_name = group_name;
+ }
+
+ public PlcGroupBuilder setGroupDescription(String group_description) {
+ this.group_description = group_description;
+ return this;
+ }
+
+ public PlcGroupBuilder setGroupUid(UUID group_uid) {
+ this.group_uid = group_uid;
+ return this;
+ }
+
+ public PlcGroupBuilder setGroupEnable(boolean group_enable) {
+ this.group_enable = group_enable;
+ return this;
+ }
+
+ public PlcGroupBuilder setGroupPeriod(long group_period) {
+ this.group_period = group_period;
+ return this;
+ }
+
+ public PlcGroup build() {
+ PlcGroup plcgroup = new PlcGroupImpl(this);
+ validatePlcGroupObject(plcgroup);
+ return plcgroup;
+ }
+
+ private void validatePlcGroupObject(PlcGroup plcgroup) {
+ //
+ }
+
+
+
+ }
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/PlcItemImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/PlcItemImpl.java
new file mode 100644
index 0000000000..e30e75fae7
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/api/impl/PlcItemImpl.java
@@ -0,0 +1,375 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * https://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.apache.plc4x.merlot.api.impl;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import java.time.LocalDate;
+import java.time.ZoneOffset;
+import java.util.Collection;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.UUID;
+import org.apache.commons.lang3.NotImplementedException;
+import org.apache.plc4x.java.api.messages.PlcReadResponse;
+import org.apache.plc4x.java.api.model.PlcTag;
+import org.apache.plc4x.java.api.types.PlcResponseCode;
+import org.apache.plc4x.java.api.value.PlcValue;
+import org.apache.plc4x.merlot.api.PlcGroup;
+import org.apache.plc4x.merlot.api.PlcItem;
+import org.apache.plc4x.merlot.api.PlcItemListener;
+
+
+public class PlcItemImpl implements PlcItem {
+
+ private String item_name;
+ private String item_description;
+ private String item_id;
+ private UUID item_uid;
+
+ private boolean item_enable = false;
+
+ private int item_accessrigths = 0;
+
+ private Boolean item_isarray = false;
+ private Boolean item_disableoutput = false;
+
+ private PlcTag item_plctag = null;
+ private Collection<Object> plcvalues = null;
+ private LinkedList<PlcItemListener> item_clients = null;
+ private ByteBuf item_buffer = null;
+
+
+ private long itemtransmit = 0;
+ private long itemreceives = 0;
+ private long itemerrors = 0;
+
+
+
+ private PlcResponseCode dataquality;
+
+ private Date lastreadtime;
+ private Date lastwritetime;
+ private Date lasterrortime;
+
+
+ public PlcItemImpl(PlcItemBuilder builder) {
+ item_name = builder.item_name;
+ item_description = builder.item_description;
+ item_id = builder.item_id;
+ item_uid = builder.item_uid;
+
+ item_enable = builder.item_enable;
+ item_accessrigths = builder.item_accessrigths;
+
+ item_isarray = builder.item_isarray;
+ item_disableoutput = builder.item_disableoutput;
+
+ item_buffer = Unpooled.buffer();
+ item_clients = new LinkedList<>();
+ }
+
+ @Override
+ public UUID getItemUid() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public String getItemName() {
+ return item_name;
+ }
+
+ @Override
+ public void setItemName(String itemname) {
+ this.item_name = itemname;
+ }
+
+ @Override
+ public String getItemDescription() {
+ return item_description;
+ }
+
+ @Override
+ public void setItemDescription(String item_description) {
+ this.item_description = item_description;
+ }
+
+ @Override
+ public String getItemId() {
+ return item_id;
+ }
+
+ @Override
+ public void setItemId(String itemid) {
+ this.item_id = itemid;
+ }
+
+ @Override
+ public PlcTag getItemPlcTag() {
+ return item_plctag;
+ }
+
+ @Override
+ public void setItemPlcTag(PlcTag itemplctag) {
+ this.item_plctag = itemplctag;
+ }
+
+ @Override
+ public Boolean getIsEnable() {
+ return item_enable;
+ }
+
+ @Override
+ public void setIsEnable(Boolean enable) {
+ this.item_enable = enable;
+
+ }
+
+ @Override
+ public Boolean getIsArray() {
+ return item_isarray;
+ }
+
+ @Override
+ public void setIsArray(Boolean isArray) {
+ this.item_isarray = isArray;
+ }
+
+ @Override
+ public Boolean getIsDisableOutput() {
+ return item_disableoutput;
+ }
+
+ @Override
+ public void setIsDisableOutput(Boolean item_disableoutput) {
+ this.item_disableoutput = item_disableoutput;
+ }
+
+ @Override
+ public long getItemTransmits() {
+ return itemtransmit;
+ }
+
+ @Override
+ public long getItemReceives() {
+ return itemreceives;
+ }
+
+ public long getItemErrors() {
+ return itemerrors;
+ }
+
+
+ @Override
+ public int getAccessRights() {
+ return item_accessrigths;
+ }
+
+ @Override
+ public void setAccessRights(int item_accessrigths) {
+ this.item_accessrigths = item_accessrigths;
+ }
+
+ @Override
+ public PlcResponseCode getDataQuality() {
+ return dataquality;
+ }
+
+ @Override
+ public void setPlcValues(PlcReadResponse plcresponse) {
+ item_buffer.clear();
+ plcvalues.forEach(v ->{
+ switch (item_plctag.getPlcValueType()){
+ case BYTE:
+ plcresponse.getAllBytes(item_uid.toString()).forEach(b -> {
+ item_buffer.writeByte(b);
+ });
+ break;
+ case CHAR:
+ case STRING:
+ plcresponse.getAllStrings(item_uid.toString()).forEach(s -> {
+ item_buffer.writeBytes(s.getBytes());
+ });
+ break;
+ case WORD:
+ case USINT:
+ case SINT:
+ case UINT:
+ case INT:
+ case DINT:
+ plcresponse.getAllIntegers(item_uid.toString()).forEach(i -> {
+ item_buffer.writeShort(i);
+ });
+ break;
+ case UDINT:
+ case ULINT:
+ case LINT:
+ plcresponse.getAllLongs(item_uid.toString()).forEach(l -> {
+ item_buffer.writeLong(l);
+ });
+ break;
+ case BOOL:
+ plcresponse.getAllBooleans(item_uid.toString()).forEach(b -> {
+ item_buffer.writeBoolean(b);
+ });
+ break;
+ case REAL:
+ case LREAL:
+ plcresponse.getAllFloats(item_uid.toString()).forEach(f -> {
+ item_buffer.writeFloat(f);
+ });
+ break;
+ case DATE_AND_TIME:
+ plcresponse.getAllDateTimes(item_uid.toString()).forEach(dt -> {
+ item_buffer.writeLong(dt.toEpochSecond(ZoneOffset.UTC));
+ });
+ break;
+ case DATE:
+ plcresponse.getAllDates(item_uid.toString()).forEach(dt -> {
+ item_buffer.writeLong(dt.toEpochDay());
+ });
+ break;
+ case TIME:
+ break;
+ case TIME_OF_DAY:
+ plcresponse.getAllTimes(item_uid.toString()).forEach(t -> {
+ item_buffer.writeLong(t.toEpochSecond(LocalDate.MAX, ZoneOffset.UTC));
+ });
+ break;
+ default:
+ throw new NotImplementedException("The response type for datatype " + item_plctag.getPlcValueType() + " is not yet implemented");
+ }
+ });
+ this.plcvalues = plcvalues;
+ }
+
+ @Override
+ public Collection<Object> getPlcValues() {
+ return plcvalues;
+ }
+
+ @Override
+ public void setDataQuality(PlcResponseCode dataquality) {
+ this.dataquality = dataquality;
+ }
+
+ @Override
+ public void addItemClient(PlcItemListener client) {
+ if (!item_clients.contains(client)) {
+ client.atach(this);
+ item_clients.add(client);
+ }
+ }
+
+ @Override
+ public void removeItemClient(PlcItemListener client) {
+ if (!item_clients.contains(client)) {
+ item_clients.remove(client);
+ client.detach();
+ }
+ }
+
+ @Override
+ public ByteBuf getItemBuffer() {
+ return item_buffer;
+ }
+
+ @Override
+ public Date getLastReadDate() {
+ return lastreadtime;
+ }
+
+ @Override
+ public Date getLastWriteDate() {
+ return lastwritetime;
+ }
+
+ @Override
+ public Date getLastErrorDate() {
+ return lasterrortime;
+ }
+
+ private void updateClients(){
+ item_clients.forEach(c -> c.update());
+ }
+
+ public static class PlcItemBuilder {
+ private final String item_name;
+ private UUID item_uid;
+ private String item_description;
+ private String item_id;
+ private Boolean item_enable = false;
+ private int item_accessrigths = 0;
+ private Boolean item_isarray = false;
+ private Boolean item_disableoutput = false;
+
+ public PlcItemBuilder(String item_name) {
+ this.item_name = item_name;
+ this.item_uid = UUID.randomUUID();
+ }
+
+ public PlcItemBuilder setItemUid(UUID item_uid) {
+ this.item_uid = item_uid;
+ return this;
+ }
+
+ public PlcItemBuilder setItemDescription(String item_description) {
+ this.item_description = item_description;
+ return this;
+ }
+
+ public PlcItemBuilder setItemId(String item_id) {
+ this.item_id = item_id;
+ return this;
+ }
+
+ public PlcItemBuilder setItemEnable(boolean item_enable) {
+ this.item_enable = item_enable;
+ return this;
+ }
+
+ public PlcItemBuilder setItemAccessrigths(int item_accessrigths) {
+ this.item_accessrigths = item_accessrigths;
+ return this;
+ }
+
+ public PlcItemBuilder setItemIsarray(Boolean item_isarray) {
+ this.item_isarray = item_isarray;
+ return this;
+ }
+
+ public PlcItemBuilder setItemDisableoutput(Boolean item_disableoutput) {
+ this.item_disableoutput = item_disableoutput;
+ return this;
+ }
+
+ public PlcItem build() {
+ PlcItem plcitem = new PlcItemImpl(this);
+ validatePlcItemObject(plcitem);
+ return plcitem;
+ }
+
+ private void validatePlcItemObject(PlcItem plcitem) {
+ //
+ }
+
+
+ }
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/Device.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/Device.java
deleted file mode 100644
index 77b0785a32..0000000000
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/java/org/apache/plc4x/merlot/das/api/Device.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * https://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.apache.plc4x.merlot.das.api;
-
-import java.util.List;
-import java.util.function.Consumer;
-import org.apache.plc4x.java.api.messages.PlcSubscriptionEvent;
-
-
-public interface Device extends org.osgi.service.device.Device {
-
- public void init() throws Exception;
-
- public void destroy() throws Exception;
-
- public void start();
-
- public void stop();
-
- public void attach(Driver driver);
-
- public DriverEvent getEvent();
-
- public void putEvent(DriverEvent event);
-
- public void doEvent(DriverEvent event, String tag);
-
- public void ReadRequest(String index, String id, DriverCallback cb);
-
- public void WriteRequest(String scalar, String id, List<String> values, DriverCallback cb);
-
- public void SubscriptionRequest(String... events);
-
- public void UnsubscriptionRequest(String... events);
-
- public void ConsumerRegister(String event, Consumer<PlcSubscriptionEvent> consumer);
-
- public void ConsumerUnRegister(String event);
-
-}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/resources/OSGI-INF/blueprint/api-service.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/resources/OSGI-INF/blueprint/api-service.xml
new file mode 100644
index 0000000000..098c63dd82
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/src/main/resources/OSGI-INF/blueprint/api-service.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <reference id="serviceEventAdmin"
+ interface="org.osgi.service.event.EventAdmin">
+ </reference>
+
+ <bean id="beanPlcDriverAdmin" class="org.apache.plc4x.merlot.api.impl.PlcDriverAdminServiceImpl" scope="singleton">
+ <argument ref="blueprintBundleContext"/>
+ <argument ref="serviceEventAdmin"/>
+ <property name="plcDriverList" ref="Plc4xDriverReference"/>
+ </bean>
+
+ <bean id="beanPlcDeviceFactory"
+ class="org.apache.plc4x.merlot.api.impl.PlcDeviceFactoryImpl"
+ scope="singleton">
+ <argument ref="blueprintBundleContext" />
+ </bean>
+
+ <reference-list id="Plc4xDriverReference"
+ interface="org.apache.plc4x.java.api.PlcDriver"
+ availability="mandatory">
+ <reference-listener bind-method="bind" unbind-method="unbind" ref="beanPlcDriverAdmin" />
+ </reference-list>
+
+ <service ref="beanPlcDeviceFactory" auto-export="interfaces">
+ <service-properties>
+ <entry key="org.apache.plc4x.device.factory" value="base"/>
+ </service-properties>
+ </service>
+
+ <service ranking="0" ref="beanPlcDriverAdmin" interface="org.apache.plc4x.merlot.api.impl.PlcDriverAdminServiceImpl">
+ <!--
+ <service-properties>
+ <entry key="DRIVER_ID" value="org.apache.plc4x.referring"/>
+ </service-properties>
+ -->
+ </service>
+
+</blueprint>
\ No newline at end of file
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/pom.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/pom.xml
index 1c226db2ac..6ac46ddf30 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/pom.xml
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/pom.xml
@@ -31,11 +31,11 @@
<version>0.11.0-SNAPSHOT</version>
<packaging>bundle</packaging>
- <name>PLC4J: Merlot :: base :: Driver & Wrapper implementation</name>
+ <name>PLC4J: Merlot :: das :: Base device impl</name>
<description>org.apache.plc4x.merlot.das.base OSGi blueprint bundle project.</description>
<build>
- <plugins>
+ <plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
@@ -47,9 +47,11 @@
<Bundle-Version>${project.version}</Bundle-Version>
<Export-Package>org.apache.plc4x.merlot.das.base*;version=${project.version}</Export-Package>
<Import-Package>*</Import-Package>
+ <Karaf-Commands>org.apache.plc4x.merlot.das.base.command*</Karaf-Commands>
</instructions>
</configuration>
</plugin>
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
@@ -59,6 +61,28 @@
<maxmem>256M</maxmem>
</configuration>
</plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>src/main/cfg/org.apache.plc4x.merlot.das.devices.cfg</file>
+ <type>cfg</type>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
</plugins>
</build>
<dependencies>
@@ -67,41 +91,10 @@
<artifactId>org.apache.karaf.shell.core</artifactId>
<version>${karaf.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.plc4x.merlot.scheduler</groupId>
- <artifactId>org.apache.plc4x.merlot.scheduler</artifactId>
- <version>0.11.0-SNAPSHOT</version>
- <exclusions>
- <exclusion>
- <groupId>org.osgi</groupId>
- <artifactId>osgi.cmpn</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.epics</groupId>
- <artifactId>epics-pvdata</artifactId>
- <version>${epics.pvdata.version}</version>
- </dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>6.0.0</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-buffer</artifactId>
- <version>${netty.version}</version>
- </dependency>
- <dependency>
- <groupId>com.lmax</groupId>
- <artifactId>disruptor</artifactId>
- <version>${disruptor.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>3.12.0</version>
+ <artifactId>osgi.core</artifactId>
+ <version>${osgi.core.version}</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
@@ -109,14 +102,24 @@
<version>${osgi.cmpn.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.plc4x.merlot.das.api</groupId>
- <artifactId>org.apache.plc4x.merlot.das.api</artifactId>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-api</artifactId>
<version>0.11.0-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-api</artifactId>
+ <groupId>org.apache.plc4x.merlot.api</groupId>
+ <artifactId>org.apache.plc4x.merlot.api</artifactId>
<version>0.11.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.plc4x.merlot.scheduler</groupId>
+ <artifactId>org.apache.plc4x.merlot.scheduler</artifactId>
+ <version>0.11.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.epics</groupId>
+ <artifactId>epics-pvdata</artifactId>
+ <version>${epics.pvdata.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/cfg/org.apache.plc4x.merlot.das.devices.cfg b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/cfg/org.apache.plc4x.merlot.das.devices.cfg
index 7205bf751e..37b0094045 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/cfg/org.apache.plc4x.merlot.das.devices.cfg
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/cfg/org.apache.plc4x.merlot.das.devices.cfg
@@ -43,7 +43,7 @@
# per device.
#
# Example:
-# org.apache.plc4x.merlot.das.devices-AS01.cfg
+# org.apache.plc4x.merlot.das.device-AS01.cfg
#
################################################################################
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDevice.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDevice.java
index bdfc76e738..a54e290879 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDevice.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDevice.java
@@ -1,30 +1,25 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ * 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.apache.plc4x.merlot.das.base.api;
-import org.apache.plc4x.merlot.das.api.Device;
+import org.apache.plc4x.merlot.api.PlcDevice;
+public interface BaseDevice extends PlcDevice {
-public interface BaseDevice extends Device {
- public void setUrl(String url);
-
- public String getUrl();
}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDeviceEvent.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDeviceEvent.java
deleted file mode 100644
index 5eddc4b258..0000000000
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDeviceEvent.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * https://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.apache.plc4x.merlot.das.base.api;
-
-
-public interface BaseDeviceEvent {
-
- public void setID(long id);
-
- public long getID();
-
-}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDeviceFactory.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDeviceFactory.java
index 82c13b9948..fdf80bf382 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDeviceFactory.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDeviceFactory.java
@@ -1,26 +1,25 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ * 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.apache.plc4x.merlot.das.base.api;
+import org.apache.plc4x.merlot.api.PlcDeviceFactory;
-public interface BaseDeviceFactory {
+
+public interface BaseDeviceFactory extends PlcDeviceFactory {
- public BaseDevice create(String serial, String url, String description);
}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDriver.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDriver.java
index 277786aff3..4118dd9304 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDriver.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDriver.java
@@ -1,27 +1,25 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ * 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.apache.plc4x.merlot.das.base.api;
-import org.apache.plc4x.merlot.das.api.Driver;
import java.time.LocalDateTime;
import org.apache.plc4x.java.api.PlcConnection;
import org.apache.plc4x.java.api.PlcDriver;
+import org.apache.plc4x.merlot.api.Driver;
import org.osgi.framework.BundleContext;
public interface BaseDriver extends Driver {
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDriverMBean.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDriverMBean.java
index 6ebb2acd2d..f22dd19fcb 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDriverMBean.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseDriverMBean.java
@@ -1,20 +1,18 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ * 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.apache.plc4x.merlot.das.base.api;
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseOptimizer.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseOptimizer.java
deleted file mode 100644
index 7a3215427c..0000000000
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/api/BaseOptimizer.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * https://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.apache.plc4x.merlot.das.base.api;
-
-import org.apache.plc4x.merlot.das.api.DriverCallback;
-import org.apache.plc4x.merlot.das.api.Optimizer;
-
-
-public interface BaseOptimizer extends Optimizer, DriverCallback {
-
-}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/BasePLCStatusCommand.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/BasePLCStatusCommand.java
deleted file mode 100644
index 417345a7bc..0000000000
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/BasePLCStatusCommand.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * https://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.apache.plc4x.merlot.das.base.command;
-
-import org.apache.karaf.shell.api.action.Action;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-
-@Command(scope = "basic", name = "status", description = "Read status of PLC.")
-@Service
-public class BasePLCStatusCommand implements Action {
-
- @Override
- public Object execute() throws Exception {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
-}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/BaseReadCommand.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/BaseReadCommand.java
deleted file mode 100644
index e3d52d5019..0000000000
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/BaseReadCommand.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * https://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.apache.plc4x.merlot.das.base.command;
-
-import org.apache.karaf.shell.api.action.Action;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-
-@Command(scope = "basic", name = "read", description = "Read a list of fields from PLC.")
-@Service
-public class BaseReadCommand implements Action {
-
- @Override
- public Object execute() throws Exception {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
-}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/BaseWriteCommand.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/BaseWriteCommand.java
deleted file mode 100644
index 9383668c4c..0000000000
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/BaseWriteCommand.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * https://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.apache.plc4x.merlot.das.base.command;
-
-import org.apache.karaf.shell.api.action.Action;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-
-@Command(scope = "basic", name = "write", description = "Write one field to the PLC.")
-@Service
-public class BaseWriteCommand implements Action {
-
- @Override
- public Object execute() throws Exception {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
-}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/DemoCommand.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/DemoCommand.java
new file mode 100644
index 0000000000..d6b369c127
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/DemoCommand.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.das.base.command;
+
+import java.util.Hashtable;
+import java.util.UUID;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.plc4x.merlot.scheduler.api.Job;
+import org.osgi.framework.BundleContext;
+import org.apache.plc4x.merlot.api.PlcGroup;
+import org.apache.plc4x.merlot.api.impl.PlcGroupImpl;
+
+
+@Command(scope = "plc4x", name = "demo_001", description = "Command for test.")
+@Service
+public class DemoCommand implements Action {
+
+// private String filter_device = "(&(" + Constants.OBJECTCLASS + "=" + Device.class.getName() + ")" +
+// "(" + org.osgi.service.device.Constants.DEVICE_SERIAL + "=dummy))";
+
+ @Reference
+ BundleContext bc;
+
+ @Override
+ public Object execute() throws Exception {
+// Hashtable properties = new Hashtable();
+// properties.putIfAbsent(Constants.DEVICE_CATEGORY, "s7");
+// properties.putIfAbsent(Constants.DEVICE_DESCRIPTION, this);
+// properties.putIfAbsent(Constants.DEVICE_SERIAL, this);
+//
+// PlcDevice plcdevice = new BaseDeviceImpl.BaseDeviceBuilder(bc, "s7://192.168.1.1","NAME","LA DESCRIPCION").build();
+// bc.registerService(PlcDevice.class.getName(), plcdevice, plcdevice.getProperties());
+
+
+ Hashtable props = new Hashtable();
+
+ props.put(PlcGroup.GROUP_NAME, "PRUEBA_DE_SCHEDULER");
+ props.put(PlcGroup.GROUP_UID, UUID.randomUUID().toString());
+ props.put(PlcGroup.GROUP_PERIOD, 1000L);
+ props.put(PlcGroup.GROUP_IMMEDIATE, true);
+ props.put(PlcGroup.GROUP_CONCURRENT, false);
+
+ PlcGroup grupo = new PlcGroupImpl.PlcGroupBuilder(bc, "PRUEBA_DE_SCHEDULER").
+ setGroupPeriod(5000).
+ build();
+
+ bc.registerService(new String[]{Job.class.getName(), PlcGroup.class.getName()}, grupo, props);
+
+ return null;
+ }
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/DeviceNewCommand.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/DeviceNewCommand.java
new file mode 100644
index 0000000000..27d478532d
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/DeviceNewCommand.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.das.base.command;
+
+import java.util.List;
+import java.util.UUID;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import static java.util.stream.Collectors.toList;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.plc4x.java.api.PlcDriver;
+import org.osgi.framework.BundleContext;
+import org.apache.plc4x.merlot.api.PlcDevice;
+import org.apache.plc4x.merlot.api.impl.PlcDeviceImpl;
+
+@Command(scope = "plc4x", name = "device-new", description = "Create a new device.")
+@Service
+public class DeviceNewCommand implements Action {
+ private static final Pattern p = Pattern.compile("^([a-zA-Z0-9]+)(:)(.*)");
+
+ @Reference
+ volatile List<PlcDriver> drivers;
+
+ @Reference
+ volatile List<PlcDevice> devices;
+
+ @Reference
+ BundleContext bc;
+
+ @Argument(index = 0, name = "Url", description = "URL of device", required = true, multiValued = false)
+ String url;
+
+ @Argument(index = 1, name = "Name", description = "Name of device.", required = true, multiValued = false)
+ String name;
+
+ @Argument(index = 2, name = "Description", description = "Description of device", required = true, multiValued = false)
+ String description;
+
+ @Override
+ public Object execute() throws Exception {
+ Matcher m = p.matcher(url);
+ UUID uuid = UUID.randomUUID();
+
+ m.matches();
+ String drivercode = m.group(1);
+
+ List<PlcDriver> devdrivers = drivers.stream().
+ filter(drv -> drv.getProtocolCode().equals(drivercode)).
+ collect(toList());
+
+ List<PlcDevice> ctxdevices = devices.stream().
+ filter(dev -> dev.getDeviceName().equals(name)).
+ collect(toList());
+
+ if (!ctxdevices.isEmpty()) {
+ System.out.println("A device with the same name exists.");
+ return null;
+ }
+
+ if (!devdrivers.isEmpty()) {
+
+ PlcDevice device = new PlcDeviceImpl.PlcDeviceBuilder(bc,
+ url,
+ name,
+ description).
+ build();
+
+
+ bc.registerService(PlcDevice.class.getName(), device, device.getProperties());
+
+ System.out.println("UID: " + uuid.toString());
+ } else {
+ System.out.println("Driver not found.");
+ }
+
+
+ return null;
+ }
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceDel.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceDel.java
new file mode 100644
index 0000000000..b55307b5d0
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceDel.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.das.base.command;
+
+import java.util.List;
+import java.util.UUID;
+import static java.util.stream.Collectors.toList;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.plc4x.java.api.PlcDriver;
+import org.osgi.framework.BundleContext;
+import org.apache.plc4x.merlot.api.PlcDevice;
+
+@Command(scope = "plc4x", name = "device-del", description = "Delete a device.")
+@Service
+public class cmdDeviceDel implements Action {
+
+ @Reference
+ volatile List<PlcDriver> drivers;
+
+ @Reference
+ volatile List<PlcDevice> devices;
+
+ @Reference
+ BundleContext bc;
+
+ @Option(name = "-n", aliases = "--name", description = "Device name.", required = false, multiValued = false)
+ String name;
+
+ @Option(name = "-i", aliases = "--uid", description = "Device identifier (UID). ", required = false, multiValued = false)
+ String uuid;
+
+
+ @Override
+ public Object execute() throws Exception {
+ List<PlcDevice> ctxdevices = null;
+
+ if (null != name) {
+ ctxdevices = devices.stream().
+ filter(dev -> dev.getDeviceName().equals(name)).
+ collect(toList());
+ } else if (null != uuid) {
+ ctxdevices = devices.stream().
+ filter(dev -> dev.getUid().equals(UUID.fromString(uuid))).
+ collect(toList());
+ }
+
+ if ((null == ctxdevices) || (ctxdevices.isEmpty())) {
+ System.out.println("A device not exists.");
+ return null;
+ }
+
+ System.out.println(">>> " + ctxdevices.get(0).getDeviceName());
+
+ return null;
+ }
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupDel.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupDel.java
new file mode 100644
index 0000000000..3fe5a34e8b
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupDel.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.das.base.command;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+
+@Command(scope = "plc4x", name = "group-del", description = "Delete a device.")
+@Service
+public class cmdDeviceGroupDel implements Action {
+
+ @Override
+ public Object execute() throws Exception {
+
+ return null;
+ }
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupItemDel.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupItemDel.java
new file mode 100644
index 0000000000..6281c0ecaf
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupItemDel.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.das.base.command;
+
+
+public class cmdDeviceGroupItemDel {
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupItemList.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupItemList.java
new file mode 100644
index 0000000000..034bb367c7
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupItemList.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.das.base.command;
+
+
+public class cmdDeviceGroupItemList {
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupItemNew.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupItemNew.java
new file mode 100644
index 0000000000..c20b571bff
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupItemNew.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.das.base.command;
+
+
+public class cmdDeviceGroupItemNew {
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupList.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupList.java
new file mode 100644
index 0000000000..957cde5f6f
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupList.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.das.base.command;
+
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.osgi.framework.BundleContext;
+
+@Command(scope = "plc4x", name = "group-list", description = "Delete a device.")
+@Service
+public class cmdDeviceGroupList implements Action {
+
+ @Reference
+ BundleContext bc;
+
+ @Option(name = "-u", aliases = "--uid", description = "Device uid.", required = true, multiValued = false)
+ String uid;
+
+ @Override
+ public Object execute() throws Exception {
+ System.out.println("");
+ return null;
+ }
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupNew.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupNew.java
new file mode 100644
index 0000000000..2c7238a533
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupNew.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.das.base.command;
+
+import java.util.Hashtable;
+import java.util.List;
+import java.util.UUID;
+import java.util.stream.Collectors;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.plc4x.merlot.scheduler.api.Job;
+import org.osgi.framework.BundleContext;
+import org.apache.plc4x.merlot.api.PlcGroup;
+import org.apache.plc4x.merlot.api.impl.PlcGroupImpl;
+
+@Command(scope = "plc4x", name = "group-new", description = "Create group for a device.")
+@Service
+public class cmdDeviceGroupNew implements Action {
+
+ @Reference
+ BundleContext bc;
+
+ @Reference
+ volatile List<PlcGroup> groups;
+
+ @Option(name = "-u", aliases = "--uid", description = "Device uid.", required = true, multiValued = false)
+ String uid;
+
+ @Option(name = "-p", aliases = "--period", description = "Group period schedule.", required = true, multiValued = false)
+ Long period;
+
+ @Argument(index = 0, name = "Name", description = "Name of the group.", required = true, multiValued = false)
+ String name;
+
+ @Argument(index = 1, name = "Description", description = "Description of group", required = true, multiValued = false)
+ String description;
+
+ @Override
+ public Object execute() throws Exception {
+
+ List<PlcGroup> mygroups = groups.stream().
+ filter(g -> g.getGroupName().equalsIgnoreCase(name)).
+ collect(Collectors.toList());
+
+ if (mygroups.size() == 0) {
+
+
+ PlcGroup group = new PlcGroupImpl.PlcGroupBuilder(bc, name).
+ setGroupPeriod(5000).build();
+
+ bc.registerService(new String[]{Job.class.getName(), PlcGroup.class.getName()},
+ group, group.getProperties());
+
+ } else {
+ System.out.println("A group with that name already exists.");
+ }
+
+ return null;
+ }
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupSchedule.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupSchedule.java
new file mode 100644
index 0000000000..d10064d3b7
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceGroupSchedule.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.das.base.command;
+
+import java.util.Hashtable;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.plc4x.merlot.scheduler.api.ScheduleOptions;
+import org.apache.plc4x.merlot.scheduler.api.Scheduler;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.apache.plc4x.merlot.api.PlcChannel;
+import org.apache.plc4x.merlot.api.PlcGroup;
+
+@Command(scope = "plc4x", name = "group-rt", description = "Delete a device.")
+@Service
+public class cmdDeviceGroupSchedule implements Action {
+
+ @Reference
+ BundleContext bc;
+
+ @Reference
+ Scheduler scheduler;
+
+ @Option(name = "-u", aliases = "--uid", description = "Channel uid.", required = true, multiValued = false)
+ String uid;
+
+ @Option(name = "-s", aliases = "--scantime", description = "Channel scan time in ms.", required = true, multiValued = false)
+ Long scantime = 100L;
+
+ @Override
+ public Object execute() throws Exception {
+ Hashtable props = new Hashtable();
+ String filter = "(" + PlcGroup.GROUP_UID + "=" + uid + ")";
+ props.put(PlcGroup.GROUP_UID, uid);
+
+ ServiceReference[] services = bc.getServiceReferences(PlcGroup.class.getName(), filter);
+
+ if (services.length > 0) {
+ String[] keys = services[0].getPropertyKeys();
+
+ String jobkey = services[0].getProperty(PlcGroup.GROUP_NAME) + "." +
+ services[0].getProperty("service.id");
+ ScheduleOptions options = scheduler.NOW(-1, scantime);
+
+ scheduler.reschedule(jobkey, options);
+
+ }
+
+ return null;
+ }
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceList.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceList.java
new file mode 100644
index 0000000000..1ee4b48590
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDeviceList.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.das.base.command;
+
+import java.util.List;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.osgi.service.device.Device;
+
+@Command(scope = "plc4x", name = "device-list", description = "List al device.")
+@Service
+public class cmdDeviceList implements Action {
+
+ @Reference
+ List<Device> devices;
+
+ @Override
+ public Object execute() throws Exception {
+ if (null != devices) {
+ devices.forEach(dev -> {
+ if (dev instanceof org.apache.plc4x.merlot.api.PlcDevice) {
+ System.out.println("Encontro un dispositivo Local");
+ }
+ });
+ } else {
+ System.out.println("No device registered.");
+ }
+ return null;
+ }
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDriverList.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDriverList.java
new file mode 100644
index 0000000000..ca4f7b1da5
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/command/cmdDriverList.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.das.base.command;
+
+import java.util.List;
+import java.util.regex.Pattern;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.support.table.ShellTable;
+import org.apache.plc4x.java.api.PlcDriver;
+import org.apache.plc4x.merlot.api.impl.PlcDriverAdminServiceImpl;
+
+//@Command(scope = "plc4x", name = "driver-list", description = "List all Plc4x drivers.")
+//@Service
+public class cmdDriverList implements Action {
+
+ @Reference
+ PlcDriverAdminServiceImpl channels;
+
+ @Override
+ public Object execute() throws Exception {
+ ShellTable table = new ShellTable();
+ table.column("Code");
+ table.column("Name");
+ List<PlcDriver> drivers = channels.getPlcDriverList();
+
+ drivers.forEach(drv -> {table.addRow().addContent(drv.getProtocolCode(), drv.getProtocolName());});
+ table.print(System.out);
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/core/BaseDeviceEventHandler.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/core/BaseDeviceEventHandler.java
deleted file mode 100644
index 28a2a614c9..0000000000
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/core/BaseDeviceEventHandler.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * https://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.apache.plc4x.merlot.das.base.core;
-
-import org.apache.plc4x.merlot.das.api.DriverEvent;
-import com.lmax.disruptor.EventHandler;
-
-
-public class BaseDeviceEventHandler implements EventHandler<DriverEvent> {
-
- @Override
- public void onEvent(DriverEvent event, long sequence, boolean endOfBatch) throws Exception {
- // TODO Auto-generated method stub
- System.out.println("Evento id: " + event.getFunctionCode());
- }
-
-}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/core/BaseDeviceManagedService.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/core/BaseDeviceManagedService.java
index bc6a51acd6..5186dd384c 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/core/BaseDeviceManagedService.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/core/BaseDeviceManagedService.java
@@ -1,72 +1,90 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * https://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.
- */
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.apache.plc4x.merlot.das.base.core;
import org.apache.plc4x.merlot.das.base.api.BaseDevice;
-import org.apache.plc4x.merlot.das.base.api.BaseDeviceFactory;
import org.apache.plc4x.merlot.scheduler.api.Job;
import org.apache.plc4x.merlot.scheduler.api.JobContext;
import java.util.Collections;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.HashMap;
-import java.util.HashSet;
+import java.util.Hashtable;
import java.util.Map;
-import java.util.Set;
+import org.apache.plc4x.java.api.PlcDriver;
+import org.apache.plc4x.merlot.das.base.impl.BaseDeviceFactoryImpl;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ConfigurationEvent;
import org.osgi.service.cm.ConfigurationException;
-import org.osgi.service.cm.ManagedServiceFactory;
+import org.osgi.service.cm.ConfigurationListener;
+import org.osgi.service.cm.ManagedService;
import org.osgi.service.device.Device;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
-
-public class BaseDeviceManagedService implements ManagedServiceFactory, Job {
+import org.apache.plc4x.merlot.api.PlcDeviceFactory;
+import org.apache.plc4x.merlot.api.PlcDevice;
+/**
+ *
+ * @author cgarcia
+ */
+public class BaseDeviceManagedService implements ManagedService, ConfigurationListener, Job {
private static final Logger LOGGER = LoggerFactory.getLogger(BaseDeviceManagedService.class);
- private final BundleContext bundleContext;
- private static Map<String, Dictionary<String, ?>> waitingConfigs = null;
+ private final BundleContext bc;
+ private static Map<String, Dictionary<String, ?>> waitingConfigs = null;
+ private String filter_driver = "(&(" + Constants.OBJECTCLASS + "=" + PlcDriver.class.getName() + ")" +
+ "(org.apache.plc4x.driver.code=*))";
private String filter_device = "(&(" + Constants.OBJECTCLASS + "=" + Device.class.getName() + ")" +
- "(" + org.osgi.service.device.Constants.DEVICE_SERIAL + "=*))";
- private String filter_factory = "(&(" + Constants.OBJECTCLASS + "=" + BaseDeviceFactory.class.getName() + ")" +
- "(device.factory=*))";
+ "(" + org.apache.plc4x.merlot.api.PlcDevice.SERVICE_NAME + "=*))";
+ private String filter_factory = "(&(" + Constants.OBJECTCLASS + "=" + PlcDeviceFactory.class.getName() + ")" +
+ "(org.apache.plc4x.device.factory=*))";
- public BaseDeviceManagedService(BundleContext bundleContext) {
- this.bundleContext = bundleContext;
+ public BaseDeviceManagedService(BundleContext bc) {
+ this.bc = bc;
waitingConfigs = Collections.synchronizedMap(new HashMap<String, Dictionary<String, ?>>());
}
- @Override
public String getName() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
+ /*
+ * Example:
+ * AS01 = s7://192.168.1.23/0/2,simatic,compresor system
+ * \__/ \___________________/ \_____/ \______________/
+ * key url name description
+ *
+ */
@Override
- public void updated(String pid, Dictionary<String, ?> props) throws ConfigurationException {
- if (props.size() < 3){
- waitingConfigs.put(pid, props);
- return;
- }
+ public void updated(Dictionary<String, ?> props) throws ConfigurationException {
+ if (null == props) return;
+
+// if (props.size() < 3){
+// waitingConfigs.put(pid, props);
+// return;
+// }
+
if (props!=null) {
Enumeration<String> keys = props.keys();
for (Enumeration e = props.keys(); e.hasMoreElements();) {
@@ -76,36 +94,59 @@ public class BaseDeviceManagedService implements ManagedServiceFactory, Job {
if (drv_data.length == 2) {
try {
String deviceFilter = filter_device.replace("*",key.toString());
- ServiceReference[] references = bundleContext.getServiceReferences((String) null, deviceFilter);
+ ServiceReference[] references = bc.getServiceReferences((String) null, deviceFilter);
if (references != null){
for (ServiceReference reference:references){
- LOGGER.info("The device already exists: " + reference.getProperty("DEVICE_DESCRIPTION"));
+ LOGGER.info("The device already exists: " + reference.getProperty(org.apache.plc4x.merlot.api.PlcDevice.SERVICE_NAME));
}
} else {
String factoryFilter = filter_factory.replace("*",drv_data[0]);
- references = bundleContext.getServiceReferences((String) null, factoryFilter);
+ references = bc.getServiceReferences((String) null, factoryFilter);
- if (references != null){
+ if (null != references){
+ //1. Si existe el factory, existe el driver.
drv_data = driver_information.split(",",3);
ServiceReference reference = references[0];
- BaseDeviceFactory bdf = (BaseDeviceFactory) bundleContext.getService(reference);
+ PlcDeviceFactory bdf = (PlcDeviceFactory) bc.getService(reference);
if (bdf != null){
- BaseDevice device = bdf.create(key.toString(), drv_data[0], drv_data[1]);
+ PlcDevice device = bdf.create(key.toString(), drv_data[0], drv_data[1], drv_data[1]);
if (device != null) {
device.start();
LOGGER.info("Starting device["+ key.toString() + "] @ url[ " + drv_data[0]+ "]");
} else {
LOGGER.info("Failed to register driver." + factoryFilter);
- waitingConfigs.put(pid, props);
+// waitingConfigs.put(pid, props);
}
} else {
LOGGER.info("The factory is not available:" + drv_data[0]);
- waitingConfigs.put(pid, props);
+// waitingConfigs.put(pid, props);
};
} else {
- LOGGER.info("Failed to register device driver." + factoryFilter);
- waitingConfigs.put(pid, props);
+ LOGGER.info("There is no factory specific for the driver [{}], using base device. to register device driver.", factoryFilter);
+ //1. Si existe un driver se puede registrar el dispositivo.
+ LOGGER.info("Clave: " + key.toString() + " : " + drv_data[0]);
+
+ //2. Registra el dispositivo con un BaseDevice
+ String factoryBaseFilter = filter_factory.replace("*","base");
+ LOGGER.info("Buscando referencia con filtro [{}].", factoryBaseFilter);
+ references = bc.getServiceReferences((String) null, factoryBaseFilter);
+
+ if ((null != references) && (references.length > 0) && (!drv_data[0].equalsIgnoreCase("file"))) {
+ ServiceReference reference = references[0];
+ Hashtable properties = new Hashtable();
+ properties.putIfAbsent(org.osgi.service.device.Constants.DEVICE_CATEGORY, drv_data[0]);
+ properties.putIfAbsent(org.osgi.service.device.Constants.DEVICE_DESCRIPTION, this);
+ properties.putIfAbsent(org.osgi.service.device.Constants.DEVICE_SERIAL, this);
+ PlcDeviceFactory bdf = (PlcDeviceFactory) bc.getService(reference);
+ drv_data = driver_information.split(",",3);
+ PlcDevice device = bdf.create(key.toString() , drv_data[0], drv_data[1], drv_data[2]);
+ LOGGER.info("Registra ahora el dispositivo...");
+ bc.registerService(org.apache.plc4x.merlot.api.PlcDevice.class.getName(), device, device.getProperties());
+
+ } else {
+ LOGGER.info("The base factory is not available.");
+ }
}
}
} catch (InvalidSyntaxException ex) {
@@ -117,27 +158,27 @@ public class BaseDeviceManagedService implements ManagedServiceFactory, Job {
}
}
}
-
- @Override
- public void deleted(String arg0) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
@Override
- public void execute(JobContext arg0) {
- String pid = null;
- Dictionary<String, ?> props = null;
- Set<String> keys = new HashSet<>();
- keys.addAll(waitingConfigs.keySet());
- for (String key:keys){
- pid = key;
- props = waitingConfigs.remove(key);
- try {
- updated(pid,props);
- } catch (ConfigurationException ex) {
- LOGGER.debug("Problem updating [" + key +"] from waiting list." );
- }
- }
+ public void execute(JobContext arg0) {
+// String pid = null;
+// Dictionary<String, ?> props = null;
+// Set<String> keys = new HashSet<>();
+// keys.addAll(waitingConfigs.keySet());
+// for (String key:keys){
+// pid = key;
+// props = waitingConfigs.remove(key);
+// try {
+// updated(pid,props);
+// } catch (ConfigurationException ex) {
+// LOGGER.debug("Problem updating [" + key +"] from waiting list." );
+// }
+// }
}
+
+ @Override
+ public void configurationEvent(ConfigurationEvent event) {
+ LOGGER.info(">>> Cambio de configuración: " + event.getPid());
+ }
}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/core/BaseDriverEvent.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/core/BaseDriverEvent.java
deleted file mode 100644
index 5c327ef75f..0000000000
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/core/BaseDriverEvent.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * https://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.apache.plc4x.merlot.das.base.core;
-
-import org.apache.plc4x.merlot.das.api.DriverCallback;
-import org.apache.plc4x.merlot.das.api.DriverEvent;
-import org.apache.plc4x.merlot.das.core.Merlot.FUNCTION;
-import com.lmax.disruptor.EventFactory;
-import io.netty.buffer.ByteBuf;
-import org.apache.plc4x.java.api.messages.PlcReadRequest;
-import org.apache.plc4x.java.api.messages.PlcReadResponse;
-import org.apache.plc4x.java.api.messages.PlcWriteRequest;
-import org.apache.plc4x.java.api.messages.PlcWriteResponse;
-
-
-public class BaseDriverEvent implements DriverEvent {
-
- long Sequence = 0;
- int TransactionID = 0;
- short ProtocolID = 0;
- int Field = 0;
- int LengthField = 0;
- byte UnitID = 0;
- FUNCTION FunctionCode;
- ByteBuf Data = null;
- DriverCallback cb = null;
-
-
- public static final EventFactory<DriverEvent> FACTORY = new EventFactory<DriverEvent>() {
- @Override
- public DriverEvent newInstance()
- {
- return new BaseDriverEvent();
- }
- };
-
- @Override
- public byte[] getSerialized() {
- return Data.array();
- }
-
- @Override
- public void setCallback(DriverCallback cb) {
- this.cb = cb;
- }
-
- @Override
- public DriverCallback getCallback() {
- return this.cb;
- }
-
- @Override
- public void setSequence(long Sequence) {
- this.Sequence = Sequence;
- }
-
- @Override
- public long getSequence() {
- return this.Sequence;
- }
-
- @Override
- public void setTransactionID(int TransactionID) {
- this.TransactionID = TransactionID;
- }
-
- @Override
- public int getTransactionID() {
- return this.TransactionID;
- }
-
- @Override
- public void setProtocolID(short ProtocolID) {
- this.ProtocolID = ProtocolID;
- }
-
- @Override
- public short getProtocolID() {
- return this.ProtocolID;
- }
-
- @Override
- public void setField(int Field) {
- this.Field = Field;
- }
-
- @Override
- public int getField() {
- return this.Field;
- }
-
- @Override
- public void setLengthField(int LengthField) {
- this.LengthField = LengthField;
- }
-
- @Override
- public int getLengthField() {
- return this.LengthField;
- }
-
- @Override
- public void setUnitID(byte UnitID) {
- this.UnitID = UnitID;
- }
-
- @Override
- public byte getUnitID() {
- return this.UnitID;
- }
-
- @Override
- public void setFunctionCode(FUNCTION FunctionCode) {
- this.FunctionCode = FunctionCode;
- }
-
- @Override
- public FUNCTION getFunctionCode() {
- return this.FunctionCode;
- }
-
- @Override
- public void setData(ByteBuf Data) {
- this.Data = Data;
- }
-
- @Override
- public ByteBuf getData() {
- return this.Data;
- }
-
- @Override
- public void setPlcReadRequest(PlcReadRequest plcReadRequest) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public PlcReadRequest getPlcReadRequest() {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public void setPlcReadResponse(PlcReadResponse plcReadResponse) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public PlcReadResponse getPlcReadResponse() {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public void setPlcWriteRequest(PlcWriteRequest plcWriteRequest) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public PlcWriteRequest getPlcWriteRequest() {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public void setPlcWriteResponse(PlcWriteResponse plcWriteResponse) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public PlcWriteResponse getPlcWriteResponse() {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
-
- @Override
- public String toString() {
- return "MerlotBasicDriverEvent [Sequence=" + Sequence + ", TransactionID=" + TransactionID + ", ProtocolID="
- + ProtocolID + ", LengthField=" + LengthField + ", UnitID=" + UnitID + ", FunctionCode=" + FunctionCode
- + ", Data=" + Data + ", cb=" + cb + "]";
- }
-
-}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseDasDriverImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseDasDriverImpl.java
deleted file mode 100644
index 17f3c98e55..0000000000
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseDasDriverImpl.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * https://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.apache.plc4x.merlot.das.base.impl;
-
-import org.apache.plc4x.merlot.das.base.api.BaseDevice;
-import org.apache.plc4x.merlot.das.base.api.BaseDriver;
-import static org.apache.plc4x.merlot.das.base.impl.BaseDriverImpl.BASIC_DEVICE_CATEGORY;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import org.apache.karaf.shell.api.action.lifecycle.Reference;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.device.Constants;
-import org.osgi.service.device.Device;
-import org.osgi.service.device.Driver;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class BaseDasDriverImpl implements Driver {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(BaseDasDriverImpl.class);
-
- @Reference
- private BundleContext bc;
-
- private BaseDevice bdev;
-
- /**
- * Try to locate a driver for the device.
- * If there is a driver associated with the device, return with 1.
- * If the driver does not exist, create an instance and register it.
- * If everything goes well, return with 1.
- * If the driver does not exist, return with Device.MATCH_NONE.
- *
- * @param reference The reference to the Device
- * @return Device.MATCH_NONE, 1
- */
- @Override
- public int match(ServiceReference reference) throws Exception {
- String driver_url;
- if (reference != null) {
- String deviceCategory = (String) reference.getProperty(Constants.DEVICE_CATEGORY);
- if (deviceCategory.equals(BASIC_DEVICE_CATEGORY)) {
- {
- ServiceReference[] services = bc.getServiceReferences(
- BaseDriver.class.getName(), null);
- if (services.length > 0){
- for(ServiceReference service:services){
- driver_url = (String) service.getProperty(Constants.DRIVER_ID);
- }
-
- } else {
-
- final Dictionary<String, Object> props = new Hashtable<>();
- props.put ( Constants.DRIVER_ID, "com.ceos.basic" );
- props.put ( "DRIVER_URL", "Eclipse SCADA Project" );
-
- BaseDriver driver = new BaseDriverImpl(bc);
-
- bc.registerService(BaseDriver.class.getName(), driver, props);
-
- return 1;
- }
-
- }
- //Busco el driver
-
- return 1;
- }
- }
- return Device.MATCH_NONE;
- }
-
-
- @Override
- public String attach(ServiceReference reference) throws Exception {
- System.out.println("Paso por aqui... ATTACH");
- if (reference != null) {
- System.out.println("Paso por aqui... PASO1");
- bdev = (BaseDevice) bc.getService(reference);
- System.out.println("Paso por aqui... PASO2");
- LOGGER.info("attach: " + bdev.toString());
- }
- return null;
- }
-
-}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseDeviceFactoryImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseDeviceFactoryImpl.java
new file mode 100644
index 0000000000..8e2c102034
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseDeviceFactoryImpl.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.das.base.impl;
+
+import org.apache.plc4x.merlot.das.base.api.BaseDeviceFactory;
+import org.apache.plc4x.merlot.das.base.core.BaseDeviceManagedService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.plc4x.merlot.api.PlcDevice;
+import org.apache.plc4x.merlot.api.PlcDeviceFactory;
+import org.apache.plc4x.merlot.api.impl.PlcDeviceImpl;
+import org.osgi.framework.BundleContext;
+
+public class BaseDeviceFactoryImpl implements PlcDeviceFactory {
+ private static final Logger LOGGER = LoggerFactory.getLogger(BaseDeviceFactory.class);
+
+ private final BundleContext bc;
+
+ public BaseDeviceFactoryImpl(BundleContext bc) {
+ this.bc = bc;
+ }
+
+ @Override
+ public PlcDevice create(String device, String url, String name, String description) {
+ return new PlcDeviceImpl.PlcDeviceBuilder(bc, url, name, description).build();
+
+ }
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseDeviceImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseDeviceImpl.java
index cd9bef3caf..ad69523fb6 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseDeviceImpl.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseDeviceImpl.java
@@ -1,203 +1,313 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ * 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.apache.plc4x.merlot.das.base.impl;
-import org.apache.plc4x.merlot.das.api.Driver;
-import org.apache.plc4x.merlot.das.api.DriverCallback;
-import org.apache.plc4x.merlot.das.api.DriverEvent;
-import org.apache.plc4x.merlot.das.core.Merlot;
-import org.apache.plc4x.merlot.das.base.api.BaseDevice;
-import org.apache.plc4x.merlot.das.base.api.BaseDriver;
-import java.time.LocalTime;
-import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
+
+import java.util.HashMap;
+import org.apache.plc4x.merlot.api.Driver;
+import java.util.Hashtable;
import java.util.List;
-import java.util.function.Consumer;
-import org.apache.plc4x.java.api.PlcConnection;
-import org.apache.plc4x.java.api.messages.PlcReadRequest;
-import org.apache.plc4x.java.api.messages.PlcSubscriptionEvent;
-import org.apache.plc4x.java.api.messages.PlcWriteRequest;
-import org.epics.pvdata.pv.ScalarType;
-import static org.epics.pvdata.pv.ScalarType.pvBoolean;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.plc4x.java.api.PlcDriver;
+import org.apache.plc4x.merlot.api.PlcDevice;
+import org.apache.plc4x.merlot.das.base.api.BaseDevice;
import org.osgi.framework.BundleContext;
+import org.osgi.service.dal.Device;
+import org.osgi.service.dal.DeviceException;
+import org.osgi.service.device.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.plc4x.merlot.api.PlcItem;
+import org.apache.plc4x.merlot.api.PlcGroup;
-
-public class BaseDeviceImpl implements BaseDevice, DriverCallback {
+ public class BaseDeviceImpl implements PlcDevice {
private static final Logger LOGGER = LoggerFactory.getLogger(BaseDeviceImpl.class);
-
protected final BundleContext bc;
- protected boolean autostart = false;
- protected Driver driver = null;
+ protected boolean enable = false;
+ protected boolean autostart = false;
+ protected UUID uid = null;
+ protected PlcDriver plcdriver = null;
protected String url = null;
- public BaseDeviceImpl(BundleContext bc) {
- this.bc = bc;
- }
+ protected Hashtable<String, Object> myProperties = new Hashtable<String, Object>();
- @SuppressWarnings("unchecked")
+ private final Map<UUID, PlcGroup> groups = new HashMap();
+
+ public BaseDeviceImpl(BaseDeviceBuilder builder) {
+ this.bc = builder.bc;
+ myProperties.put(Device.SERVICE_DRIVER, builder.service_driver);
+ myProperties.put(Device.SERVICE_NAME, builder.service_name);
+ myProperties.put(Device.SERVICE_DESCRIPTION, builder.service_description);
+ if (null != builder.device_category) myProperties.put(Constants.DEVICE_CATEGORY, builder.device_category);
+
+ if (null != builder.service_uid) myProperties.put(Device.SERVICE_UID, builder.service_uid);
+
+ if (null != builder.service_firmware_vendor) myProperties.put(Device.SERVICE_FIRMWARE_VENDOR, builder.service_firmware_vendor);
+ if (null != builder.service_firmware_version) myProperties.put(Device.SERVICE_FIRMWARE_VERSION, builder.service_firmware_version);
+ if (null != builder.service_hardware_vendor) myProperties.put(Device.SERVICE_HARDWARE_VENDOR, builder.service_hardware_vendor);
+ if (null != builder.service_hardware_version) myProperties.put(Device.SERVICE_HARDWARE_VERSION, builder.service_hardware_version);
+ if (null != builder.service_model) myProperties.put(Device.SERVICE_MODEL, builder.service_model);
+ if (null != builder.service_reference_uids) myProperties.put(Device.SERVICE_REFERENCE_UIDS, builder.service_reference_uids);
+ if (null != builder.service_serial_number) myProperties.put(Device.SERVICE_SERIAL_NUMBER, builder.service_serial_number);
+ if (null != builder.service_status) myProperties.put(Device.SERVICE_STATUS, builder.service_status);
+ if (null != builder.service_status_detail) myProperties.put(Device.SERVICE_STATUS_DETAIL, builder.service_status_detail);
+ if (null != builder.service_types) myProperties.put(Device.SERVICE_TYPES, builder.service_types);
+ }
+
@Override
- public void init() throws Exception {
+ public void init() throws Exception {
+ //
}
@Override
public void destroy() throws Exception {
+ //
}
@Override
public void start() {
- autostart = true;
+ if (null != plcdriver) {
+ //Try to connect
+
+ //if is ok then enable
+ enable = true;
+ }
}
@Override
public void stop() {
+ enable = false;
+ //Disconect from plc.
+
+ }
+
+ @Override
+ public Hashtable<String, ?> getProperties() {
+ return myProperties;
+ }
+
+
+ @Override
+ public String getDeviceName() {
+ return (String) myProperties.get(Device.SERVICE_NAME);
}
@Override
- public void attach(Driver driver) {
- this.driver = driver;
+ public void setDeviceName(String devicename) {
+ myProperties.put(Device.SERVICE_NAME, devicename);
}
-
+
@Override
- public void putEvent(DriverEvent event) {
- if (event.getCallback() == null) {
- event.setCallback(this);
- }
- driver.putEvent(event);
+ public String getDeviceDescription() {
+ return (String) myProperties.get(Device.SERVICE_DESCRIPTION);
}
@Override
- public DriverEvent getEvent() {
- return driver.getEvent();
+ public void setDeviceDescription(String devicedescription) {
+ myProperties.put(Device.SERVICE_DESCRIPTION, devicedescription);
}
@Override
- public void noDriverFound() {
- LOGGER.info("no driver found...");
- driver = null;
- }
-
- @Override
- public void execute(DriverEvent cb) {
- LOGGER.info(cb.toString());
- }
-
- @Override
- public void doEvent(DriverEvent event, String tag) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void ReadRequest(String index, String item, DriverCallback cb) {
- PlcConnection plcConn = ((BaseDriver) driver).getPlcConnection();
- if (plcConn.isConnected()){
- PlcReadRequest.Builder requestBuilder = plcConn.readRequestBuilder();
- requestBuilder.addTagAddress(index, item);
- PlcReadRequest readRequest = requestBuilder.build(); //EX
-
- DriverEvent event = ((BaseDriver) driver).getEvent();
- event.setFunctionCode(Merlot.FUNCTION.FC_READ_MEMORY_BYTES);
- event.setPlcReadRequest(readRequest);
- event.setCallback((cb == null)?this:cb);
- ((BaseDriver) driver).putEvent(event);
- } else {
- LOGGER.info("Device no connected");
- }
- }
-
- @Override
- public void WriteRequest(String scalar, String id, List<String> values, DriverCallback cb) {
- DateTimeFormatter dtf = DateTimeFormatter.ofPattern("HH:mm:ss:SSS");
- PlcConnection plcConn = ((BaseDriver) driver).getPlcConnection();
- if (plcConn.isConnected()){
- PlcWriteRequest.Builder requestBuilder = plcConn.writeRequestBuilder();
- List<Object> items = new ArrayList();
- switch(ScalarType.getScalarType(scalar)){
- case pvBoolean:for (String value:values)items.add(Boolean.parseBoolean(value));
- break;
- case pvByte:
- case pvUByte: for (String value:values)items.add(Byte.parseByte(value));
- break;
- case pvDouble: for (String value:values)items.add(Double.parseDouble(value));
- break;
- case pvFloat: for (String value:values)items.add(Float.parseFloat(value));
- break;
- case pvInt:
- case pvUInt: for (String value:values)items.add(Integer.decode(value));
- break;
- case pvLong:
- case pvULong: for (String value:values)items.add(Long.parseLong(value));
- break;
- case pvShort:
- case pvUShort: for (String value:values)items.add(Short.parseShort(value));
- break;
- case pvString: for (String value:values)items.add(value);
- break;
-
- }
- requestBuilder.addTagAddress("Write@["+LocalTime.now().format(dtf)+"]", id, items.toArray());
-
- PlcWriteRequest writeRequest = requestBuilder.build(); //EX
-
- DriverEvent event = ((BaseDriver) driver).getEvent();
- event.setFunctionCode(Merlot.FUNCTION.FC_WRITE_DATA_BYTES);
- event.setPlcReadRequest(null);
- event.setPlcWriteRequest(writeRequest);
- event.setCallback((cb == null)?this:cb);
- ((BaseDriver) driver).putEvent(event);
- } else {
- LOGGER.info("Device no connected");
- }
+ public void setUid(UUID uid) {
+ this.uid = uid;
+ }
+ @Override
+ public UUID getUid() {
+ return uid;
}
-
+
+
@Override
- public void SubscriptionRequest(String... events) {
+ public boolean isEnable() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
- public void UnsubscriptionRequest(String... events) {
+ public void setEnable(boolean enable) {
throw new UnsupportedOperationException("Not supported yet.");
- }
+ }
@Override
- public void ConsumerRegister(String event, Consumer<PlcSubscriptionEvent> consumer) {
+ public void setUrl(String url) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
- public void ConsumerUnRegister(String event) {
+ public String getUrl() {
throw new UnsupportedOperationException("Not supported yet.");
}
-
-
+
@Override
- public void setUrl(String url) {
- this.url = url;
+ public void putGroup(PlcGroup group) {
+ if (!enable) {
+ Hashtable props = new Hashtable();
+ props.put(PlcGroup.GROUP_NAME, "PRUEBA_DE_SCHEDULER");
+ props.put(PlcGroup.GROUP_UID, UUID.randomUUID().toString());
+ props.put(PlcGroup.GROUP_PERIOD, 1000L);
+ props.put(PlcGroup.GROUP_IMMEDIATE, true);
+ props.put(PlcGroup.GROUP_CONCURRENT, false);
+ groups.put(group.getGroupUid(), group);
+ }
}
@Override
- public String getUrl() {
- return url;
+ public PlcGroup getGroup(UUID uid) {
+ return groups.get(uid);
+ }
+
+ @Override
+ public void removeGroup(UUID uid) {
+ groups.remove(uid);
+ }
+
+ @Override
+ public List<PlcGroup> getGroups() {
+ return null;
+ }
+
+
+ @Override
+ public void noDriverFound() {
+ LOGGER.info("The associated driver is not found. go to IDLE.");
+ }
+
+ @Override
+ public Object getServiceProperty(String propKey) {
+ return myProperties.get(propKey);
+ }
+
+ @Override
+ public String[] getServicePropertyKeys() {
+ return myProperties.keySet().toArray(new String[myProperties.size()]);
+ }
+
+ @Override
+ public void remove() throws DeviceException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void attach(PlcDriver driver) {
+ LOGGER.info("Device: {} attach to driver {} ", myProperties.get(Device.SERVICE_NAME), driver.getProtocolCode());
+ this.plcdriver = driver;
}
+
+ public static class BaseDeviceBuilder {
+ private final BundleContext bc;
+ private final String service_name;
+ private final String service_description;
+ private final String service_driver;
+ private String service_uid;
+ private String device_category;
+ private String service_firmware_vendor;
+ private String service_firmware_version;
+ private String service_hardware_vendor;
+ private String service_hardware_version;
+ private String service_model;
+ private String[] service_reference_uids;
+ private String service_serial_number;
+ private String service_status;
+ private String service_status_detail;
+ private String[] service_types;
+
+ public BaseDeviceBuilder(BundleContext bc, String service_driver, String service_name, String service_description) {
+ this.bc = bc;
+ this.service_name = service_name;
+ this.service_description = service_description;
+ this.service_driver = service_driver;
+ String[] drv = service_driver.split(":");
+ this.device_category = drv[0];
+ }
+
+ public BaseDeviceBuilder setServiceUid(String serviceuid) {
+ this.service_uid = serviceuid;
+ return this;
+ }
+
+ public BaseDeviceBuilder setDeviceCategory(String device_category) {
+ this.device_category = device_category;
+ return this;
+ }
+
+ public BaseDeviceBuilder setServiceFirmwareVendor(String service_firmware_vendor) {
+ this.service_firmware_vendor = service_firmware_vendor;
+ return this;
+ }
+
+ public BaseDeviceBuilder setServiceFirmwareVersion(String service_firmware_version) {
+ this.service_firmware_version = service_firmware_version;
+ return this;
+ }
+
+ public BaseDeviceBuilder setServiceHardwareVendor(String service_hardware_vendor) {
+ this.service_hardware_vendor = service_hardware_vendor;
+ return this;
+ }
+
+ public BaseDeviceBuilder setServiceHardwareVersion(String service_hardware_version) {
+ this.service_hardware_version = service_hardware_version;
+ return this;
+ }
+
+ public BaseDeviceBuilder setServiceModel(String service_model) {
+ this.service_model = service_model;
+ return this;
+ }
+
+ public BaseDeviceBuilder setServiceReferenceUids(String[] service_reference_uids) {
+ this.service_reference_uids = service_reference_uids;
+ return this;
+ }
+
+ public BaseDeviceBuilder setServiceSerialNumber(String service_serial_number) {
+ this.service_serial_number = service_serial_number;
+ return this;
+ }
+
+ public BaseDeviceBuilder setServiceStatus(String service_status) {
+ this.service_status = service_status;
+ return this;
+ }
+
+ public BaseDeviceBuilder setServiceStatusDetail(String service_status_detail) {
+ this.service_status_detail = service_status_detail;
+ return this;
+ }
+
+ public BaseDeviceBuilder setServiceTypes(String[] service_types) {
+ this.service_types = service_types;
+ return this;
+ }
+
+
+ public PlcDevice build() {
+ PlcDevice plcdevice = new BaseDeviceImpl(this);
+ validateBaseDeviceObject(plcdevice);
+ return plcdevice;
+ }
+
+ private void validateBaseDeviceObject(PlcDevice plcdevice) {
+ //
+ }
+ }
+
+
}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseDriverImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseDriverImpl.java
deleted file mode 100644
index 98091aec24..0000000000
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseDriverImpl.java
+++ /dev/null
@@ -1,523 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * https://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.apache.plc4x.merlot.das.base.impl;
-
-import org.apache.plc4x.merlot.das.api.Device;
-import org.apache.plc4x.merlot.das.api.DriverEvent;
-import org.apache.plc4x.merlot.das.core.Merlot;
-import org.apache.plc4x.merlot.das.core.Merlot.STATE;
-import org.apache.plc4x.merlot.das.base.api.BaseDevice;
-import org.apache.plc4x.merlot.das.base.api.BaseDriver;
-import org.apache.plc4x.merlot.das.base.api.BaseOptimizer;
-import org.apache.plc4x.merlot.das.base.core.BaseDriverEvent;
-import com.lmax.disruptor.BlockingWaitStrategy;
-import com.lmax.disruptor.EventHandler;
-import com.lmax.disruptor.RingBuffer;
-import com.lmax.disruptor.dsl.Disruptor;
-import com.lmax.disruptor.dsl.ProducerType;
-import com.lmax.disruptor.util.DaemonThreadFactory;
-import java.time.LocalDateTime;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-import org.apache.commons.lang3.time.StopWatch;
-import org.apache.plc4x.java.api.PlcConnection;
-import org.apache.plc4x.java.api.messages.PlcReadRequest;
-import org.apache.plc4x.java.api.messages.PlcRequest;
-import org.apache.plc4x.java.api.messages.PlcResponse;
-import org.apache.plc4x.java.api.PlcDriver;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class BaseDriverImpl implements BaseDriver {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(BaseDriverImpl.class);
-
- static final String BASIC_DEVICE_CATEGORY = "basic";
- static final String BASIC_DRIVER_ID = "com.ceos.basic";
-
- //State of the driver
- protected STATE state = STATE.STOPPED;
-
- // Executor that will be used to construct new threads for consumers
- protected Executor RequestExecutor;
- protected Executor ResponseExecutor;
-
- //Disruptor
- protected Disruptor<DriverEvent> RequestDisruptor;
- protected Disruptor<DriverEvent> ResponseDisruptor;
-
- //Ring Buffer
- protected RingBuffer<DriverEvent> RequestRingBuffer;
- protected RingBuffer<DriverEvent> ResponseRingBuffer;
-
-
- protected PlcDriver plcDriver = null;
- protected PlcConnection plcConn = null;
- protected PlcReadRequest.Builder plcBuilder = null;
- protected PlcRequest plcRequest = null;
- protected PlcResponse plcResponse = null;
- protected String url = null;
- protected Boolean started = false;
- protected Boolean connected = false;
-
-
- //Some stats
- protected LocalDateTime stats_StartDateTime;
- protected LocalDateTime stats_LastFailDateTime;
- protected StopWatch stats_RunningTime = new StopWatch() ;
- protected StopWatch stats_StoppedTime = new StopWatch();
- protected long stats_SendMessages = 0L;
- protected long stats_FailedMessages = 0L;
- protected long stats_delay = 0L;
- protected long stats_max_delay = 0L;
- protected long stats_min_delay = 0L;
-
- // The factory for the event
- //MerlotBasicDeviceEventFactory factory = new MerlotBasicDeviceEventFactory();
-
- // Specify the size of the ring buffer, must be power of 2.
- int bufferSize = 1024;
- protected long ressequence = 0;
- boolean returnvalue = false;
-
- protected BundleContext bc;
-
- protected BaseDevice bdev;
-
- protected BaseOptimizer optimizer = null;
-
-
- /**
- *
- * @param bc
- */
- public BaseDriverImpl(BundleContext bc){
- this.bc = bc;
- this.plcDriver = null;
- this.stats_RunningTime.start(); this.stats_RunningTime.suspend();
- this.stats_StoppedTime.start(); this.stats_StoppedTime.suspend();
- }
-
- @Override
- public void init() throws Exception {
-
-
-
- RequestExecutor = Executors.newCachedThreadPool();
- ResponseExecutor = Executors.newCachedThreadPool();
-
- // Construct the Disruptor
- RequestDisruptor = new Disruptor<DriverEvent>(BaseDriverEvent.FACTORY, 1024, DaemonThreadFactory.INSTANCE,
- ProducerType.MULTI, new BlockingWaitStrategy());
-
- ResponseDisruptor = new Disruptor<DriverEvent>(BaseDriverEvent.FACTORY, 1024, DaemonThreadFactory.INSTANCE,
- ProducerType.SINGLE, new BlockingWaitStrategy());
-
- RequestRingBuffer = RequestDisruptor.getRingBuffer();
- ResponseRingBuffer = ResponseDisruptor.getRingBuffer();
-
- RequestDisruptor.handleEventsWith(new EventHandler<DriverEvent>() {
- @Override
- public void onEvent(DriverEvent rxevent, long sequence, boolean endOfBatch) throws Exception {
- long start = System.currentTimeMillis();
- try {
-
- ressequence = ResponseRingBuffer.next(); // Grab the next sequence
- DriverEvent txevent = ResponseRingBuffer.get(ressequence); // Get the entry in the Disruptor
-
- switch(rxevent.getFunctionCode()) {
- case M_INITIATE_CNF:;
- LOGGER.info("Executing : Merlot.M_INITIATE_CNF.");
- break;
- case M_READ_CNF:;
- LOGGER.info("Executing : Merlot.M_READ_CNF.");
- break;
- case M_WRITE_CNF:;
- LOGGER.info("Executing : Merlot.M_WRITE_CNF.");
- break;
- case M_MULTIPLE_READ_CNF:;
- LOGGER.info("Executing : Merlot.M_MULTIPLE_READ_CNF.");
- break;
- case M_MULTIPLE_WRITE_CNF:;
- LOGGER.info("Executing : Merlot.M_MULTIPLE_WRITE_CNF.");
- break;
- case M_CYCL_READ_INIT_CNF:;
- LOGGER.info("Executing : Merlot.M_CYCL_READ_INIT_CNF.");
- break;
- case M_CYCL_READ_START_CNF:;
- LOGGER.info("Executing : Merlot.M_CYCL_READ_START_CNF.");
- break;
- case M_CYCL_READ_STOP_CNF:;
- LOGGER.info("Executing : Merlot.M_CYCL_READ_STOP_CNF.");
- break;
- case M_CYCL_READ_DELETE_CNF:;
- LOGGER.info("Executing : Merlot.M_CYCL_READ_DELETE_CNF.");
- break;
- case M_PASSWORD_CNF:;
- LOGGER.info("Executing : Merlot.M_PASSWORD_CNF.");
- break;
- case M_PASSWORD_LEN:;
- LOGGER.info("Executing : Merlot.M_PASSWORD_LEN.");
- break;
- case M_RESET_PASSWORD:;
- LOGGER.info("Executing : Merlot.M_RESET_PASSWORD.");
- break;
- default:
- LOGGER.info("No command function in the event.");
- break;
- }
-
- if (plcRequest != null){
- plcResponse = plcRequest.execute().get();
- }
-
- txevent.setSequence(ressequence);
- txevent.setFunctionCode(rxevent.getFunctionCode());
- txevent.setData(rxevent.getData()); //Pointer to data buffer
- txevent.setCallback(rxevent.getCallback());
-
- rxevent.setCallback(null);
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } finally {
- ResponseRingBuffer.publish(ressequence);
- long finish = System.currentTimeMillis();
- stats_delay = finish - start;
- if (stats_delay > stats_max_delay){stats_max_delay = stats_delay;};
- if (stats_min_delay == 0L){stats_min_delay = stats_delay;};
- if (stats_delay < stats_min_delay){stats_min_delay = stats_delay;};
- }
- }
- });
-
- ResponseDisruptor.handleEventsWith((event, sequence, endOfBatch) -> {
- try {
- if (event.getCallback() != null){
- event.getCallback().execute(event);
- };
- } catch (Exception e) {
- e.printStackTrace();
- }
- });
-
- RequestDisruptor.start();
- ResponseDisruptor.start();
-
- start();
- }
-
- @Override
- public void destroy() throws Exception {
- stop();
- RequestDisruptor.shutdown();
- ResponseDisruptor.shutdown();
- }
-
-
- @Override
- public void reset() {
- if ((state != STATE.STOPPED) && (state != STATE.COMPLETE)) return;
- state = STATE.RESETTING;
- }
-
- @Override
- public void start() {
- if (state != STATE.IDLE) return;
- try {
- if(stats_RunningTime.isSuspended()) stats_RunningTime.resume();
- if(!stats_StoppedTime.isSuspended()) stats_StoppedTime.suspend();
- } catch (Exception ex) {
- LOGGER.info(ex.toString());
- }
- state = STATE.STARTING;
- }
-
- @Override
- public void stop() {
- //TODO Evaluate drainAndHalt()
- if(!stats_RunningTime.isSuspended()) stats_RunningTime.suspend();
- if(stats_StoppedTime.isSuspended()) stats_StoppedTime.resume();
- state = STATE.STOPPING;
- }
-
- @Override
- public void abort() {
- state = STATE.ABORTING;
- }
-
- @Override
- public void clear() {
- if (state != STATE.ABORTED) return;
- state = STATE.ABORTING;
- }
-
- @Override
- public void hold() {
- if (state != STATE.EXECUTE) return;
- state = STATE.HOLDING;
- }
-
- @Override
- public void unhold() {
- if (state != STATE.UNHOLDING) return;
- state = STATE.EXECUTE;
- }
-
- @Override
- public void suspend() {
- if (state != STATE.EXECUTE) return;
- state = STATE.SUSPENDING;
- }
-
- @Override
- public void unsuspend() {
- if (state != STATE.SUSPENDED) return;
- state = STATE.UNSUSPENDING;
- }
-
- @Override
- public void onStopped() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void onResetting() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void onIdle() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void onStarting() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void onExecute() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void onCompleting() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void onComplete() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void onHolding() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void onHeld() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void onUnholding() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void onSuspending() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void onSuspended() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void onUnsuspending() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void onAborting() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void onAborted() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void onClearing() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void onStopping() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
-
- @Override
- public STATE getState() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void setBundleContext(BundleContext bundleContext) {
- this.bc = bundleContext;
- }
-
- @Override
- public DriverEvent getEvent() {
- if ((!connected) || (!started)) return null;
- long sequence = RequestRingBuffer.next(); // Grab the next sequence
- DriverEvent de = RequestRingBuffer.get(sequence); // Get the entry in the Disruptor
- de.setSequence(sequence);
- return de;
- }
-
- @Override
- public void putEvent(DriverEvent event) {
- RequestRingBuffer.publish(event.getSequence());
- }
-
- @Override
- public int match(ServiceReference reference) throws Exception {
- LOGGER.info("match: " + reference.getProperty("DEVICE_CATEGORY"));
- if (BASIC_DRIVER_ID.matches((String) reference.getProperty("DEVICE_CATEGORY"))) {
- return 1;
- } else {
- return Device.MATCH_NONE;
- }
- }
-
- @Override
- public String attach(ServiceReference reference) throws Exception {
- LOGGER.info("attach: " + reference.getProperty("DEVICE_CATEGORY"));
- BaseDevice device = (BaseDevice) bc.getService(reference);
- device.attach(this);
- return null;
- }
-
- @Override
- public void setPlcDriver(PlcDriver plcDriver) {
- this.plcDriver = plcDriver;
- }
-
- @Override
- public PlcDriver getPlcDriver() {
- return plcDriver;
- }
-
- @Override
- public PlcConnection getPlcConnection() {
- return plcConn;
- }
-
- @Override
- public DriverEvent EventFactory(Merlot m) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void setUrl(String url) {
- this.url = url;
- }
-
- @Override
- public String getUrl() {
- return url;
- }
-
- @Override
- public LocalDateTime getStartDateTime() {
- return this.stats_StartDateTime;
- }
-
- @Override
- public LocalDateTime getLastFailDateTime() {
- return this.stats_LastFailDateTime;
- }
-
- @Override
- public long getRunningTime() {
- return this.stats_RunningTime.getTime();
- }
-
- @Override
- public long getStoppedTime() {
- return this.stats_StoppedTime.getTime();
- }
-
- @Override
- public long getSendMessages() {
- return this.stats_SendMessages;
- }
-
- @Override
- public long getFailedMessages() {
- return this.stats_FailedMessages;
- }
-
- @Override
- public long getDelay() {
- return stats_delay;
- }
-
- @Override
- public long getMaxDelay() {
- return stats_max_delay;
- }
-
- @Override
- public long getMinDelay() {
- return stats_min_delay;
- }
-
- @Override
- public long getRequestQueueSize() {
- return RequestRingBuffer.getBufferSize();
- }
-
- @Override
- public long getRequestQueueItems() {
- return (RequestRingBuffer.getBufferSize() - RequestRingBuffer.remainingCapacity());
- }
-
- @Override
- public long getResponseQueueSize() {
- return ResponseRingBuffer.getBufferSize();
- }
-
- @Override
- public long getResponseQueueItems() {
- return (ResponseRingBuffer.getBufferSize() - ResponseRingBuffer.remainingCapacity());
- }
-
-
-}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseDriverMBeanImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseDriverMBeanImpl.java
index b08ef05bf3..0d75bf0fa3 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseDriverMBeanImpl.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseDriverMBeanImpl.java
@@ -1,20 +1,7 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * https://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.
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
*/
package org.apache.plc4x.merlot.das.base.impl;
@@ -24,7 +11,10 @@ import java.time.LocalDateTime;
import javax.management.NotCompliantMBeanException;
import javax.management.StandardMBean;
-
+/**
+ *
+ * @author cgarcia
+ */
public class BaseDriverMBeanImpl extends StandardMBean implements BaseDriverMBean {
private final BaseDriver driver;
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseFunctionImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseFunctionImpl.java
new file mode 100644
index 0000000000..3bc862abcb
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseFunctionImpl.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.das.base.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.plc4x.java.api.PlcDriver;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.dal.Function;
+import org.osgi.service.dal.OperationMetadata;
+import org.osgi.service.dal.PropertyMetadata;
+import org.apache.plc4x.merlot.api.PlcDevice;
+import org.osgi.framework.BundleContext;
+
+
+public class BaseFunctionImpl implements Function {
+
+ protected final BundleContext bc;
+ private Map<String, PlcDevice> plcdevices = new HashMap<String, PlcDevice>();
+
+ public BaseFunctionImpl(BundleContext bc) {
+ this.bc = bc;
+ }
+
+ public void bind(ServiceReference reference) {
+ //
+ System.out.println("Registro dispositivo reference...");
+ }
+
+ public void bind(PlcDevice plcdevice){
+ if (null != plcdevice) {
+ System.out.println("Registro dispositivo PlcDevice...");
+ plcdevices.put(plcdevice.getUid().toString(), plcdevice);
+ }
+ }
+
+ public void unbind(ServiceReference deviceref){
+ System.out.println("DeRegistro dispositivo PlcDevice...");
+ final PlcDevice plcdevice = (PlcDevice) deviceref.getBundle();
+ plcdevices.remove(plcdevice.getUid().toString());
+ }
+
+
+ @Override
+ public PropertyMetadata getPropertyMetadata(String propertyName) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public OperationMetadata getOperationMetadata(String operationName) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Object getServiceProperty(String propKey) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public String[] getServicePropertyKeys() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseGroupImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseGroupImpl.java
new file mode 100644
index 0000000000..b3cd4bdb32
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseGroupImpl.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.das.base.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.plc4x.merlot.scheduler.api.Job;
+import org.apache.plc4x.merlot.scheduler.api.JobContext;
+import org.osgi.framework.BundleContext;
+import org.apache.plc4x.merlot.api.PlcItem;
+import org.apache.plc4x.merlot.api.PlcGroup;
+
+
+public class BaseGroupImpl implements PlcGroup, Job {
+
+ private UUID uid;
+
+ private String groupname;
+ private String groupdescription;
+
+ private boolean enable = false;
+
+ private long scantime;
+ private long deadband;
+
+ private long grouptransmit = 0;
+ private long groupreceives = 0;
+ private long grouperrors = 0;
+
+ private long groupitems = 0;
+ private long groupupdatrate = -1;
+
+ private final Hashtable<String, Object> myproperties = new Hashtable();
+ private final Map<UUID, PlcItem> items = new Hashtable();
+
+ private long[] aux = new long[1];
+
+ public BaseGroupImpl(String name) {
+ myproperties.put(PlcGroup.GROUP_NAME, name);
+ }
+
+
+ public void start(int bc){
+ //
+ }
+
+ public void stop(int bc){
+ //
+ }
+
+ @Override
+ public UUID getGroupUid() {
+ return (UUID) myproperties.get(PlcGroup.GROUP_UID);
+ }
+
+ @Override
+ public String getGroupName() {
+ return (String) myproperties.get(PlcGroup.GROUP_NAME);
+ }
+
+ @Override
+ public void setGroupName(String groupname) {
+ myproperties.put(PlcGroup.GROUP_NAME, groupname);
+ }
+
+ @Override
+ public String getGroupDescription() {
+ return (String) myproperties.get(PlcGroup.GROUP_DESCRIPTION);
+ }
+
+ @Override
+ public void setGroupDescription(String groupdescription) {
+ myproperties.put(PlcGroup.GROUP_DESCRIPTION, groupdescription);
+ }
+
+ @Override
+ public boolean isEnable() {
+ return enable;
+ }
+
+ @Override
+ public void setEnable(boolean enable) {
+ this.enable = enable;
+ }
+
+ @Override
+ public long getGroupTransmit() {
+ aux[0] = 0;
+ items.forEach((uid, item) -> {aux[0] = +item.getItemTransmits();});
+ return aux[0];
+ }
+
+ @Override
+ public long getGroupReceives() {
+ aux[0] = 0;
+ items.forEach((uid, item) -> {aux[0] = +item.getItemReceives();});
+ return aux[0];
+ }
+
+ @Override
+ public long getGroupErrors() {
+ aux[0] = 0;
+ items.forEach((uid, item) -> {aux[0] = +item.getItemErrors();});
+ return aux[0];
+ }
+
+
+
+ @Override
+ public void setGroupItems(long groupitems) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+
+
+ @Override
+ public void putItem(PlcItem item) {
+ items.put(item.getItemUid(), item);
+ }
+
+ @Override
+ public PlcItem getItem(UUID itemuid) {
+ return items.get(itemuid);
+ }
+
+ //TODO: remove from context
+ @Override
+ public void removeItem(UUID itemuid) {
+ items.remove(itemuid);
+ }
+
+ @Override
+ public List<PlcItem> getItems() {
+ return null;
+ }
+
+ @Override
+ public void execute(JobContext context) {
+ if (enable) {
+ System.out.println("Tamaño de la coleccion: " + items.size());
+ }
+ }
+
+ @Override
+ public long getPeriod() {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public void setPeriod(long scantime) {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public Map<UUID, PlcItem> getGroupItems() {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public Hashtable<String, Object> getProperties() {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseItemImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseItemImpl.java
new file mode 100644
index 0000000000..e92f8c64c9
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseItemImpl.java
@@ -0,0 +1,209 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.das.base.impl;
+
+import io.netty.buffer.ByteBuf;
+import java.util.Collection;
+import java.util.Date;
+import java.util.UUID;
+import org.apache.plc4x.java.api.messages.PlcReadResponse;
+import org.apache.plc4x.java.api.model.PlcTag;
+import org.apache.plc4x.java.api.types.PlcResponseCode;
+import org.apache.plc4x.merlot.api.PlcItem;
+import org.apache.plc4x.merlot.api.PlcItemListener;
+
+
+public class BaseItemImpl implements PlcItem {
+
+ private UUID uid;
+
+ private String itemname;
+ private String itemdescription;
+
+ private String id;
+
+ private boolean enable = false;
+
+ private boolean isarray = false;
+ private int arraystart = 0;
+
+ private boolean disableoutput = true;
+
+ private long itemtransmits = 0;
+ private long itemreceives = 0;
+ private long itemerrors = 0;
+
+ private int accessrights = 0;
+ private int dataquality = 0;
+
+ private Date lastreaddate;
+ private Date lastwritedate;
+ private Date lasterrordate;
+
+ @Override
+ public UUID getItemUid() {
+ return uid;
+ }
+
+ @Override
+ public String getItemName() {
+ return itemname;
+ }
+
+ @Override
+ public void setItemName(String itemname) {
+ this.itemname = itemname;
+ }
+
+ @Override
+ public String getItemDescription() {
+ return itemdescription;
+ }
+
+ @Override
+ public void setItemDescription(String itemdescription) {
+ this.itemdescription = itemdescription;
+ }
+
+ @Override
+ public String getItemId() {
+ return id;
+ }
+
+ @Override
+ public void setItemId(String itemid) {
+ this.id = itemid;
+ }
+
+ @Override
+ public Boolean getIsEnable() {
+ return enable;
+ }
+
+ @Override
+ public void setIsEnable(Boolean enable) {
+ this.enable = enable;
+ }
+
+ @Override
+ public Boolean getIsArray() {
+ return isarray;
+ }
+
+ @Override
+ public void setIsArray(Boolean isarray) {
+ this.isarray = isarray;
+ }
+
+
+ @Override
+ public Boolean getIsDisableOutput() {
+ return disableoutput;
+ }
+
+ @Override
+ public void setIsDisableOutput(Boolean isDisableOutput) {
+ this.disableoutput = isDisableOutput;
+ }
+
+ @Override
+ public long getItemTransmits() {
+ return itemtransmits;
+ }
+
+ @Override
+ public long getItemReceives() {
+ return itemreceives;
+ }
+
+ @Override
+ public long getItemErrors() {
+ return itemerrors;
+ }
+
+ @Override
+ public int getAccessRights() {
+ return accessrights;
+ }
+
+ @Override
+ public void setAccessRights(int accessrigths) {
+ this.accessrights = accessrigths;
+ }
+
+
+ @Override
+ public Date getLastReadDate() {
+ return lastreaddate;
+ }
+
+ @Override
+ public Date getLastWriteDate() {
+ return lastwritedate;
+ }
+
+ @Override
+ public Date getLastErrorDate() {
+ return lasterrordate;
+ }
+
+ @Override
+ public PlcTag getItemPlcTag() {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public void setItemPlcTag(PlcTag itemplctag) {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public PlcResponseCode getDataQuality() {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public void setDataQuality(PlcResponseCode dataquality) {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public void setPlcValues(PlcReadResponse plcresponse) {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public Collection<Object> getPlcValues() {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public ByteBuf getItemBuffer() {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public void addItemClient(PlcItemListener client) {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ @Override
+ public void removeItemClient(PlcItemListener client) {
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseOptimizerImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseOptimizerImpl.java
deleted file mode 100644
index 02d611dbbd..0000000000
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/java/org/apache/plc4x/merlot/das/base/impl/BaseOptimizerImpl.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * https://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.apache.plc4x.merlot.das.base.impl;
-
-import org.apache.plc4x.merlot.das.api.Driver;
-import org.apache.plc4x.merlot.das.api.DriverEvent;
-import org.apache.plc4x.merlot.das.base.api.BaseOptimizer;
-
-
-public class BaseOptimizerImpl implements BaseOptimizer {
-
-
- @Override
- public void init() throws Exception {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public void destroy() throws Exception {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public void start() {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public void stop() {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public boolean isOptimized() {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public void setOptimizaed(boolean optimized) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public boolean doOptimization(Driver driver, DriverEvent rxevent, DriverEvent txevent) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public void execute(DriverEvent cb) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
-
-}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/resources/OSGI-INF/blueprint/base-service.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/resources/OSGI-INF/blueprint/base-service.xml
new file mode 100644
index 0000000000..5986ba8107
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/resources/OSGI-INF/blueprint/base-service.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
+
+
+ <bean id="beanBDFactory"
+ class="org.apache.plc4x.merlot.das.base.impl.BaseDeviceFactoryImpl"
+ scope="singleton">
+ <argument ref="blueprintBundleContext" />
+ </bean>
+
+ <bean id="beanBDManagedService"
+ class="org.apache.plc4x.merlot.das.base.core.BaseDeviceManagedService"
+ scope="singleton">
+ <argument ref="blueprintBundleContext" />
+ </bean>
+
+ <bean id="beanBFunctionService"
+ class="org.apache.plc4x.merlot.das.base.impl.BaseFunctionImpl"
+ scope="singleton">
+ <argument ref="blueprintBundleContext" />
+ </bean>
+
+<!-- <service ref="beanBDFactory" auto-export="interfaces">
+ <service-properties>
+ <entry key="device.factory" value="base"/>
+ </service-properties>
+ </service> -->
+
+ <reference-list id="Plc4DeviceReference"
+ interface="org.apache.plc4x.merlot.api.PlcDevice"
+ availability="optional">
+ <reference-listener bind-method="bind" unbind-method="unbind" ref="beanBFunctionService" />
+ </reference-list>
+
+ <service ref="beanBDManagedService" auto-export="interfaces">
+ <service-properties>
+ <entry key="service.pid" value="org.apache.plc4x.merlot.das.devices"/>
+ <entry key="scheduler.name" value="BaseDeviceManagedService"/>
+ <entry key="scheduler.period" value="5000"/>
+ <entry key="scheduler.immediate" value="true"/>
+ <entry key="scheduler.concurrent" value="false"/>
+ </service-properties>
+ </service>
+
+ <service ref="beanBFunctionService" auto-export="interfaces">
+ </service>
+
+</blueprint>
\ No newline at end of file
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/resources/OSGI-INF/blueprint/basedevice-service.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/resources/OSGI-INF/blueprint/basedevice-service.xml
deleted file mode 100644
index 92645f9a22..0000000000
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/resources/OSGI-INF/blueprint/basedevice-service.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/*
- * Copyright 2019 César GarcÃa
- * cesar.garcia@ceos.com.ve
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="eager">
-
- <reference id="DeviceManagerService"
- interface="org.apache.plc4x.merlot.das.api.DeviceManager"
- timeout="10000"
- availability="mandatory">
- </reference>
-
- <bean id="BaseDeviceBean" class="org.apache.plc4x.merlot.das.base.impl.BaseDeviceImpl"
- init-method="init" destroy-method="destroy" scope="singleton">
- <argument ref="blueprintBundleContext" />
- </bean>
-
- <bean id="BaseDriverBean" class="org.apache.plc4x.merlot.das.base.impl.BaseDriverImpl"
- init-method="init" destroy-method="destroy" scope="singleton">
- <argument ref="blueprintBundleContext" />
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </bean>
-
- <bean id="BaseDeviceManagedService"
- class="org.apache.plc4x.merlot.das.base.core.BaseDeviceManagedService"
- scope="singleton">
- <argument ref="blueprintBundleContext" />
- </bean>
-
- <!--
- <service id="BasicDriverService" ref="BasicDriverBean" interface="org.osgi.service.device.Driver">
- <service-properties>
- <entry key="DRIVER_ID" value="org.apache.plc4x.basic"/>
- </service-properties>
- </service>
- -->
- <service ref="BaseDeviceManagedService" auto-export="interfaces">
- <service-properties>
- <entry key="service.pid" value="org.apache.plc4x.merlot.das.devices"/>
- <entry key="scheduler.name" value="BaseDeviceManagedService"/>
- <entry key="scheduler.period" value="5000"/>
- <!-- <entry key="scheduler.times" value="5"/> -->
- <entry key="scheduler.immediate" value="true"/>
- <entry key="scheduler.concurrent" value="false"/>
- </service-properties>
- </service>
-
-
-</blueprint>
\ No newline at end of file
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/resources/OSGI-INF/bundle.info b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/resources/OSGI-INF/bundle.info
deleted file mode 100644
index 5d6943520d..0000000000
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.base/src/main/resources/OSGI-INF/bundle.info
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You 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.
-#
-#
-h1. Synopsis
-
- ${project.name}
-
- ${project.description}
-
- Maven URL:
- [mvn:${project.groupId}/${project.artifactId}/${project.version}]
-
-h1. Description
-
- This package implements all the basic functionalities of a device or driver. The rest of the components that implement the API must extend these classes.
-
-h1. Commands
-
- The bundle contains the following commands:
-\${command-list|basic|indent=8,list,cyan}
-
-
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/pom.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.ref/pom.xml
similarity index 74%
copy from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/pom.xml
copy to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.ref/pom.xml
index 1e1eb98008..994b422981 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/pom.xml
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.ref/pom.xml
@@ -26,13 +26,13 @@
<version>0.11.0-SNAPSHOT</version>
</parent>
- <groupId>org.apache.plc4x.merlot.das.api</groupId>
- <artifactId>org.apache.plc4x.merlot.das.api</artifactId>
+ <groupId>org.apache.plc4x.merlot.das.ref</groupId>
+ <artifactId>org.apache.plc4x.merlot.das.ref</artifactId>
<version>0.11.0-SNAPSHOT</version>
<packaging>bundle</packaging>
- <name>PLC4J: Merlot :: api :: OSGi Device access</name>
- <description>org.apache.plc4x.merlot.das.api OSGi blueprint bundle project.</description>
+ <name>PLC4J: Merlot :: das :: Referring driver</name>
+ <description>org.apache.plc4x.merlot.das.ref OSGi blueprint bundle project.</description>
<build>
<plugins>
@@ -45,7 +45,7 @@
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
- <Export-Package>org.apache.plc4x.merlot.das.api*;version=${project.version}</Export-Package>
+ <Export-Package>org.apache.plc4x.merlot.das.ref*;version=${project.version}</Export-Package>
<Import-Package>*</Import-Package>
</instructions>
</configuration>
@@ -63,9 +63,19 @@
</build>
<dependencies>
<dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-buffer</artifactId>
- <version>${netty.version}</version>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.cmpn</artifactId>
+ <version>${osgi.cmpn.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.core</artifactId>
+ <version>${osgi.core.version}</version>
</dependency>
<dependency>
<groupId>org.apache.plc4x</groupId>
@@ -73,14 +83,14 @@
<version>0.11.0-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>org.osgi</groupId>
- <artifactId>osgi.cmpn</artifactId>
- <version>${osgi.cmpn.version}</version>
+ <groupId>org.apache.plc4x.merlot.api</groupId>
+ <artifactId>org.apache.plc4x.merlot.api</artifactId>
+ <version>0.11.0-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>com.lmax</groupId>
- <artifactId>disruptor</artifactId>
- <version>${disruptor.version}</version>
+ <groupId>org.apache.plc4x.merlot.das.base</groupId>
+ <artifactId>org.apache.plc4x.merlot.das.base</artifactId>
+ <version>0.11.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.ref/src/main/java/org/apache/plc4x/merlot/das/ref/api/MyService.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.ref/src/main/java/org/apache/plc4x/merlot/das/ref/api/MyService.java
new file mode 100644
index 0000000000..a5d40f6470
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.ref/src/main/java/org/apache/plc4x/merlot/das/ref/api/MyService.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.das.ref.api;
+
+public interface MyService {
+
+ public String echo(String message);
+
+}
\ No newline at end of file
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.ref/src/main/java/org/apache/plc4x/merlot/das/ref/api/MyServiceImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.ref/src/main/java/org/apache/plc4x/merlot/das/ref/api/MyServiceImpl.java
new file mode 100644
index 0000000000..e4450958fa
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.ref/src/main/java/org/apache/plc4x/merlot/das/ref/api/MyServiceImpl.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.das.ref.api;
+
+public class MyServiceImpl implements MyService {
+
+ public String echo(String message) {
+ return "Echo processed: " + message;
+ }
+
+}
\ No newline at end of file
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.ref/src/main/java/org/apache/plc4x/merlot/das/ref/impl/Plc4xReferringDriverImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.ref/src/main/java/org/apache/plc4x/merlot/das/ref/impl/Plc4xReferringDriverImpl.java
new file mode 100644
index 0000000000..dcaca7f6d1
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.ref/src/main/java/org/apache/plc4x/merlot/das/ref/impl/Plc4xReferringDriverImpl.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * https://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.apache.plc4x.merlot.das.ref.impl;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.plc4x.java.api.PlcDriver;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.device.Constants;
+import org.apache.plc4x.merlot.api.PlcDevice;
+import org.osgi.service.device.Driver;
+import org.osgi.service.event.EventAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class Plc4xReferringDriverImpl implements Driver {
+ private static final Logger LOGGER = LoggerFactory.getLogger(Plc4xReferringDriverImpl.class);
+ private BundleContext bc;
+ private final EventAdmin eventAdmin;
+ private Map<String, PlcDriver> drivers = new HashMap<String, PlcDriver>();
+
+ public Plc4xReferringDriverImpl(BundleContext bc, EventAdmin eventAdmin) {
+ this.bc = bc;
+ this.eventAdmin = eventAdmin;
+ }
+
+ /*
+ * It verifies that there is a PlcDriver registered in the context and
+ * compares it with the one required by the device.
+ */
+ @Override
+ public int match(ServiceReference<?> reference) throws Exception {
+ if (!drivers.isEmpty()) {
+ final String drv_code = (String) reference.getProperty(Constants.DEVICE_CATEGORY);
+ final PlcDriver plcdriver = drivers.get(drv_code);
+ if (null == plcdriver) {
+ final PlcDevice plcdev = (PlcDevice) bc.getService(reference);
+ plcdev.noDriverFound();
+ } else {
+ return 1;
+ }
+ }
+ return org.osgi.service.device.Device.MATCH_NONE; // =0
+ }
+
+ /*
+ * Attach the PlcDriver to PlcDevice.
+ */
+ @Override
+ public String attach(ServiceReference<?> reference) throws Exception {
+ final String drv_code = (String) reference.getProperty(Constants.DEVICE_CATEGORY);
+ final PlcDriver plcdriver = drivers.get(drv_code);
+ final PlcDevice plcdev = (PlcDevice) bc.getService(reference);
+ plcdev.attach(plcdriver);
+
+ return null;
+ }
+
+ public void bind(ServiceReference reference) {
+ //
+ }
+
+ public void bind(PlcDriver driver){
+ if (null != driver) {
+ drivers.put(driver.getProtocolCode(), driver);
+ }
+ }
+
+ public void unbind(ServiceReference driver){
+ PlcDriver drv = (PlcDriver) bc.getService(driver);
+ drivers.remove(drv.getProtocolCode());
+ }
+
+ public void setPlcDriverList(List<PlcDriver> drivers) {
+ //
+ }
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.ref/src/main/resources/OSGI-INF/blueprint/referring-drv-service.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.ref/src/main/resources/OSGI-INF/blueprint/referring-drv-service.xml
new file mode 100644
index 0000000000..41ef9ecb1b
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.ref/src/main/resources/OSGI-INF/blueprint/referring-drv-service.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="eager">
+
+ <reference id="serviceEventAdmin"
+ interface="org.osgi.service.event.EventAdmin">
+ </reference>
+
+ <bean id="RefDrvImpl" class="org.apache.plc4x.merlot.das.ref.impl.Plc4xReferringDriverImpl" scope="singleton">
+ <argument ref="blueprintBundleContext"/>
+ <argument ref="serviceEventAdmin"/>
+ <property name="plcDriverList" ref="Plc4xDriverReference"/>
+ </bean>
+
+ <reference-list id="Plc4xDriverReference"
+ interface="org.apache.plc4x.java.api.PlcDriver"
+ availability="mandatory">
+ <reference-listener bind-method="bind" unbind-method="unbind" ref="RefDrvImpl" />
+ </reference-list>
+
+ <service ranking="0" ref="RefDrvImpl" interface="org.osgi.service.device.Driver">
+ <service-properties>
+ <entry key="DRIVER_ID" value="org.apache.plc4x.referring"/>
+ </service-properties>
+ </service>
+
+</blueprint>
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das/pom.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das/pom.xml
index af96dbb62d..d29dd0b504 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das/pom.xml
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das/pom.xml
@@ -79,5 +79,15 @@
<artifactId>org.osgi.service.device</artifactId>
<version>${osgi.device.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-api</artifactId>
+ <version>0.10.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.plc4x.merlot.api</groupId>
+ <artifactId>org.apache.plc4x.merlot.api</artifactId>
+ <version>0.11.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
</project>
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das/src/main/java/org/apache/plc4x/merlot/das/impl/DeviceManagerImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das/src/main/java/org/apache/plc4x/merlot/das/impl/DeviceManagerImpl.java
index 9216ac86f5..dcf47fade2 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das/src/main/java/org/apache/plc4x/merlot/das/impl/DeviceManagerImpl.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das/src/main/java/org/apache/plc4x/merlot/das/impl/DeviceManagerImpl.java
@@ -188,7 +188,6 @@ public class DeviceManagerImpl implements DeviceManager {
{
final Driver driver = Driver.class.cast( obj );
m_drivers.put( ref, new DriverAttributes( ref, driver ) );
-
LOGGER.debug( "driver appeared: " + Util.showDriver( ref ) );
//immediately check for idle devices
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das/src/main/java/org/apache/plc4x/merlot/das/impl/WhiteBoardHandlerImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das/src/main/java/org/apache/plc4x/merlot/das/impl/WhiteBoardHandlerImpl.java
index 36aba6f137..30310bb819 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das/src/main/java/org/apache/plc4x/merlot/das/impl/WhiteBoardHandlerImpl.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das/src/main/java/org/apache/plc4x/merlot/das/impl/WhiteBoardHandlerImpl.java
@@ -32,8 +32,6 @@ import org.osgi.util.tracker.ServiceTrackerCustomizer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
-
/**
* The quartz based implementation of the scheduler.
*
@@ -51,10 +49,9 @@ public class WhiteBoardHandlerImpl implements WhiteBoardHandler {
public WhiteBoardHandlerImpl(final BundleContext context, final DeviceManager manager) throws InvalidSyntaxException {
this.manager = manager;
- // "(" + Constants.OBJECTCLASS + "=" + com.ceos.merlot.api.Driver.class.getName() + "))" +
+ //(" + Constants.OBJECTCLASS + "=" + org.apache.plc4x.java.api.PlcDriver.class.getName() + ")" +
this.DriverTracker = new ServiceTracker<>(context,
- context.createFilter("(|(|(" + Constants.OBJECTCLASS + "=" + Driver.class.getName() + ")" +
-
+ context.createFilter("(|(" + Constants.OBJECTCLASS + "=" + Driver.class.getName() + ")" +
"("+ org.osgi.service.device.Constants.DRIVER_ID + "=*))"),
new ServiceTrackerCustomizer<Object,Object>() {
@@ -76,10 +73,10 @@ public class WhiteBoardHandlerImpl implements WhiteBoardHandler {
}
});
- // "(" + Constants.OBJECTCLASS + "=" + com.ceos.merlot.api.Device.class.getName() + "))" +
+ //|((" + Constants.OBJECTCLASS + "=" + org.apache.plc4x.merlot.api.PlcDevice.class.getName() + "))
this.DeviceTracker = new ServiceTracker<>(context,
- context.createFilter("(|(|(" + Constants.OBJECTCLASS + "=" + Device.class.getName() + ")" +
-
+ context.createFilter("(|(" + Constants.OBJECTCLASS + "=" + org.apache.plc4x.merlot.api.PlcDevice.class.getName() + ")" +
+ "(" + Constants.OBJECTCLASS + "=" + Device.class.getName() + ")" +
"(" + org.osgi.service.device.Constants.DEVICE_CATEGORY + "=*))"),
new ServiceTrackerCustomizer<Object,Object>() {
@@ -117,12 +114,12 @@ public class WhiteBoardHandlerImpl implements WhiteBoardHandler {
@Override
public void start() {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void stop() {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ throw new UnsupportedOperationException("Not supported yet.");
}
/**
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.db/pom.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.db/pom.xml
index a76a046557..ce75dd03d8 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.db/pom.xml
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.db/pom.xml
@@ -111,16 +111,6 @@
<artifactId>org.apache.plc4x.merlot.scheduler</artifactId>
<version>0.11.0-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>org.apache.plc4x.merlot.das.api</groupId>
- <artifactId>org.apache.plc4x.merlot.das.api</artifactId>
- <version>0.11.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.plc4x.merlot.das.base</groupId>
- <artifactId>org.apache.plc4x.merlot.das.base</artifactId>
- <version>0.11.0-SNAPSHOT</version>
- </dependency>
<dependency>
<groupId>org.epics</groupId>
<artifactId>epics-pvaccess</artifactId>
@@ -131,5 +121,15 @@
<artifactId>org.osgi.core</artifactId>
<version>6.0.0</version>
</dependency>
+ <dependency>
+ <groupId>com.ceos.merlot.das.drv.basic</groupId>
+ <artifactId>com.ceos.merlot.das.drv.basic</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.plc4x.merlot.base</groupId>
+ <artifactId>org.apache.plc4x.merlot.base</artifactId>
+ <version>0.11.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
</project>
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.db/src/main/java/org/apache/plc4x/merlot/db/api/DBCollector.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.db/src/main/java/org/apache/plc4x/merlot/db/api/DBCollector.java
index 27c156aab1..e474f35d4d 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.db/src/main/java/org/apache/plc4x/merlot/db/api/DBCollector.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.db/src/main/java/org/apache/plc4x/merlot/db/api/DBCollector.java
@@ -18,7 +18,7 @@
*/
package org.apache.plc4x.merlot.db.api;
-import org.apache.plc4x.merlot.das.api.DriverCallback;
+import org.apache.plc4x.merlot.api.DriverCallback;
import org.apache.plc4x.merlot.scheduler.api.Job;
import java.util.Collection;
import org.epics.pvdatabase.PVRecord;
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.db/src/main/java/org/apache/plc4x/merlot/db/core/DBRecordsManagedService.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.db/src/main/java/org/apache/plc4x/merlot/db/core/DBRecordsManagedService.java
index 7b4295b73e..fba1deab60 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.db/src/main/java/org/apache/plc4x/merlot/db/core/DBRecordsManagedService.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.db/src/main/java/org/apache/plc4x/merlot/db/core/DBRecordsManagedService.java
@@ -18,7 +18,7 @@
*/
package org.apache.plc4x.merlot.db.core;
-import org.apache.plc4x.merlot.das.base.api.BaseDriver;
+import org.apache.plc4x.merlot.base.api.BaseDriver;
import org.apache.plc4x.merlot.db.api.DBControl;
import org.apache.plc4x.merlot.db.api.DBRecordFactory;
import org.apache.plc4x.merlot.scheduler.api.Job;
@@ -49,7 +49,7 @@ public class DBRecordsManagedService implements ManagedServiceFactory, Job {
private static final Logger LOGGER = LoggerFactory.getLogger(DBRecordsManagedService.class);
private final PVDatabase master;
private static Map<String, Dictionary<String, ?>> waitingConfigs = null;
- static final String PID = "com.ceos.merlot.db.records";
+ static final String PID = "org.apache.plc4x.merlot.db.records";
static final String FILE_PATH = "felix.fileinstall.filename";
private String filter = "(&(" + Constants.OBJECTCLASS + "=" + DBRecordFactory.class.getName() + ")"+
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.db/src/main/java/org/apache/plc4x/merlot/db/impl/DBCollectorImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.db/src/main/java/org/apache/plc4x/merlot/db/impl/DBCollectorImpl.java
index b2658ab9da..e0e0735d85 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.db/src/main/java/org/apache/plc4x/merlot/db/impl/DBCollectorImpl.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.db/src/main/java/org/apache/plc4x/merlot/db/impl/DBCollectorImpl.java
@@ -18,9 +18,9 @@
*/
package org.apache.plc4x.merlot.db.impl;
-import org.apache.plc4x.merlot.das.api.DriverEvent;
-import org.apache.plc4x.merlot.das.core.Merlot;
-import org.apache.plc4x.merlot.das.base.api.BaseDriver;
+import org.apache.plc4x.merlot.api.DriverEvent;
+import org.apache.plc4x.merlot.api.core.Merlot;
+import org.apache.plc4x.merlot.base.api.BaseDriver;
import org.apache.plc4x.merlot.db.api.DBCollector;
import org.apache.plc4x.merlot.scheduler.api.JobContext;
import java.util.Collection;
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/pom.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.derby/pom.xml
similarity index 72%
copy from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/pom.xml
copy to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.derby/pom.xml
index 1e1eb98008..d71cad4e59 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/pom.xml
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.derby/pom.xml
@@ -26,13 +26,13 @@
<version>0.11.0-SNAPSHOT</version>
</parent>
- <groupId>org.apache.plc4x.merlot.das.api</groupId>
- <artifactId>org.apache.plc4x.merlot.das.api</artifactId>
+ <groupId>org.apache.plc4x.merlot.derby</groupId>
+ <artifactId>org.apache.plc4x.merlot.derby</artifactId>
<version>0.11.0-SNAPSHOT</version>
<packaging>bundle</packaging>
- <name>PLC4J: Merlot :: api :: OSGi Device access</name>
- <description>org.apache.plc4x.merlot.das.api OSGi blueprint bundle project.</description>
+ <name>PLC4J: Merlot :: db :: Derby Tcp Server</name>
+ <description>org.apache.plc4x.merlot.derby OSGi blueprint bundle project.</description>
<build>
<plugins>
@@ -45,7 +45,7 @@
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
- <Export-Package>org.apache.plc4x.merlot.das.api*;version=${project.version}</Export-Package>
+ <Export-Package>org.apache.plc4x.merlot.derby*;version=${project.version}</Export-Package>
<Import-Package>*</Import-Package>
</instructions>
</configuration>
@@ -63,24 +63,14 @@
</build>
<dependencies>
<dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-buffer</artifactId>
- <version>${netty.version}</version>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbynet</artifactId>
+ <version>${derby.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-api</artifactId>
- <version>0.11.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>osgi.cmpn</artifactId>
- <version>${osgi.cmpn.version}</version>
- </dependency>
- <dependency>
- <groupId>com.lmax</groupId>
- <artifactId>disruptor</artifactId>
- <version>${disruptor.version}</version>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>${derby.version}</version>
</dependency>
</dependencies>
</project>
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.derby/src/main/java/org/apache/plc4x/merlot/derby/api/DerbyService.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.derby/src/main/java/org/apache/plc4x/merlot/derby/api/DerbyService.java
new file mode 100644
index 0000000000..8e0843d8b1
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.derby/src/main/java/org/apache/plc4x/merlot/derby/api/DerbyService.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.derby.api;
+
+public interface DerbyService {
+
+ public void init();
+
+ public void destroy();
+
+}
\ No newline at end of file
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.derby/src/main/java/org/apache/plc4x/merlot/derby/impl/DerbyServiceImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.derby/src/main/java/org/apache/plc4x/merlot/derby/impl/DerbyServiceImpl.java
new file mode 100644
index 0000000000..60126234fa
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.derby/src/main/java/org/apache/plc4x/merlot/derby/impl/DerbyServiceImpl.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.derby.impl;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.apache.derby.drda.NetworkServerControl;
+import org.apache.plc4x.merlot.derby.api.DerbyService;
+
+public class DerbyServiceImpl implements DerbyService {
+
+ NetworkServerControl server;
+
+ @Override
+ public void init() {
+ try {
+ NetworkServerControl server = new NetworkServerControl();
+ server.start(null);
+ } catch (Exception ex) {
+ System.out.println(ex.getMessage());
+ Logger.getLogger(DerbyServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+
+ @Override
+ public void destroy() {
+ try {
+ server.shutdown();
+ } catch (Exception ex) {
+ System.out.println(ex.getMessage());
+ Logger.getLogger(DerbyServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.derby/src/main/resources/OSGI-INF/blueprint/derby-svr-service.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.derby/src/main/resources/OSGI-INF/blueprint/derby-svr-service.xml
new file mode 100644
index 0000000000..1728c09b8c
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.derby/src/main/resources/OSGI-INF/blueprint/derby-svr-service.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.5.0"
+ default-activation="lazy">
+ <!--
+ <bean id="serviceBean" class="org.apache.plc4x.merlot.derby.MyServiceImpl"/>
+
+ <service ref="serviceBean" interface="org.apache.plc4x.merlot.derby.MyService"/>
+ -->
+
+ <!-- Allow the use of system properties -->
+ <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]">
+ <ext:default-properties>
+ <ext:property name="derby.system.home" value="./data/derby"/>
+ </ext:default-properties>
+ </ext:property-placeholder>
+
+ <bean id = "DerbyTcpServer"
+ scope="singleton"
+ class="org.apache.plc4x.merlot.derby.impl.DerbyServiceImpl"
+ init-method="init"
+ destroy-method="destroy"
+ activation="eager">
+ </bean>
+
+</blueprint>
\ No newline at end of file
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/pom.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.drv.simulated/pom.xml
similarity index 74%
copy from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/pom.xml
copy to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.drv.simulated/pom.xml
index 1e1eb98008..5184042955 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/pom.xml
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.drv.simulated/pom.xml
@@ -26,13 +26,13 @@
<version>0.11.0-SNAPSHOT</version>
</parent>
- <groupId>org.apache.plc4x.merlot.das.api</groupId>
- <artifactId>org.apache.plc4x.merlot.das.api</artifactId>
+ <groupId>org.apache.plc4x.merlot.drv.simulated</groupId>
+ <artifactId>org.apache.plc4x.merlot.drv.simulated</artifactId>
<version>0.11.0-SNAPSHOT</version>
<packaging>bundle</packaging>
- <name>PLC4J: Merlot :: api :: OSGi Device access</name>
- <description>org.apache.plc4x.merlot.das.api OSGi blueprint bundle project.</description>
+ <name>PLC4J: Merlot :: sim :: Simulated driver</name>
+ <description>org.apache.plc4x.merlot.drv.simulated OSGi blueprint bundle project.</description>
<build>
<plugins>
@@ -45,7 +45,7 @@
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
- <Export-Package>org.apache.plc4x.merlot.das.api*;version=${project.version}</Export-Package>
+ <Export-Package>org.apache.plc4x.merlot.drv.simulated*;version=${project.version}</Export-Package>
<Import-Package>*</Import-Package>
</instructions>
</configuration>
@@ -63,24 +63,14 @@
</build>
<dependencies>
<dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-buffer</artifactId>
- <version>${netty.version}</version>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-api</artifactId>
+ <groupId>org.apache.plc4x.merlot.base</groupId>
+ <artifactId>org.apache.plc4x.merlot.base</artifactId>
<version>0.11.0-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>osgi.cmpn</artifactId>
- <version>${osgi.cmpn.version}</version>
- </dependency>
- <dependency>
- <groupId>com.lmax</groupId>
- <artifactId>disruptor</artifactId>
- <version>${disruptor.version}</version>
- </dependency>
</dependencies>
</project>
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.drv.simulated/src/main/java/org/apache/plc4x/merlot/drv/simulated/api/MyService.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.drv.simulated/src/main/java/org/apache/plc4x/merlot/drv/simulated/api/MyService.java
new file mode 100644
index 0000000000..66e8289ddd
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.drv.simulated/src/main/java/org/apache/plc4x/merlot/drv/simulated/api/MyService.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.drv.simulated.api;
+
+public interface MyService {
+
+ public String echo(String message);
+
+}
\ No newline at end of file
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.drv.simulated/src/main/java/org/apache/plc4x/merlot/drv/simulated/api/MyServiceImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.drv.simulated/src/main/java/org/apache/plc4x/merlot/drv/simulated/api/MyServiceImpl.java
new file mode 100644
index 0000000000..ee5d04424c
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.drv.simulated/src/main/java/org/apache/plc4x/merlot/drv/simulated/api/MyServiceImpl.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.drv.simulated.api;
+
+public class MyServiceImpl implements MyService {
+
+ public String echo(String message) {
+ return "Echo processed: " + message;
+ }
+
+}
\ No newline at end of file
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.drv.simulated/src/main/java/org/apache/plc4x/merlot/drv/simulated/impl/SimulatedReferringDriverImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.drv.simulated/src/main/java/org/apache/plc4x/merlot/drv/simulated/impl/SimulatedReferringDriverImpl.java
new file mode 100644
index 0000000000..595ca4ca10
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.drv.simulated/src/main/java/org/apache/plc4x/merlot/drv/simulated/impl/SimulatedReferringDriverImpl.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * https://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.apache.plc4x.merlot.drv.simulated.impl;
+
+import org.apache.plc4x.java.api.PlcDriver;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.device.Driver;
+import org.osgi.service.event.EventAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class SimulatedReferringDriverImpl implements Driver {
+ private static final Logger LOGGER = LoggerFactory.getLogger(SimulatedReferringDriverImpl.class);
+ private BundleContext bc;
+ private final EventAdmin eventAdmin;
+ private PlcDriver plcdriver = null;
+
+ public SimulatedReferringDriverImpl(BundleContext bc, EventAdmin eventAdmin) {
+ System.out.println("Creo el objeto.....");
+ this.bc = bc;
+ this.eventAdmin = eventAdmin;
+ }
+
+ @Override
+ public int match(ServiceReference reference) throws Exception {
+ System.out.println("Match not supported yet.");
+ return 0;
+ }
+
+ @Override
+ public String attach(ServiceReference reference) throws Exception {
+ System.out.println("Attach not supported yet.");
+ return null;
+ }
+
+ public void bind(ServiceReference reference) {
+ System.out.println(">>> Bind ref to simulated driver");
+ }
+
+ public void bind(PlcDriver driver){
+ System.out.println(">>> Bind simulated driver");
+ this.plcdriver = driver;
+ }
+
+ public void unbind(ServiceReference driver){
+ System.out.println(">>> Unbind ref to simulated driver");
+ this.plcdriver = null;
+ }
+
+}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.drv.simulated/src/main/resources/OSGI-INF/blueprint/simulated-drv--service.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.drv.simulated/src/main/resources/OSGI-INF/blueprint/simulated-drv--service.xml
new file mode 100644
index 0000000000..89db26df55
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.drv.simulated/src/main/resources/OSGI-INF/blueprint/simulated-drv--service.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="eager">
+
+<!-- <bean id="serviceBean" class="org.apache.plc4x.merlot.drv.simulated.MyServiceImpl"/>
+
+ <service ref="serviceBean" interface="org.apache.plc4x.merlot.drv.simulated.MyService"/>-->
+
+ <reference id="serviceEventAdmin"
+ interface="org.osgi.service.event.EventAdmin">
+ </reference>
+
+ <bean id="SimRefDrvImpl" class="org.apache.plc4x.merlot.drv.simulated.impl.SimulatedReferringDriverImpl" scope="singleton">
+ <argument ref="blueprintBundleContext"/>
+ <argument ref="serviceEventAdmin"/>
+ </bean>
+
+ <reference id="servicePLC4XSimulated"
+ interface="org.apache.plc4x.java.api.PlcDriver"
+ filter="(org.apache.plc4x.driver.code=simulated)"
+ timeout="10000"
+ availability="mandatory">
+ <reference-listener bind-method="bind" unbind-method="unbind" ref="SimRefDrvImpl" />
+ </reference>
+
+ <service ranking="0" ref="SimRefDrvImpl" interface="org.osgi.service.device.Driver">
+ <service-properties>
+ <entry key="DRIVER_ID" value="org.apache.plc4x.simulated"/>
+ </service-properties>
+ </service>
+
+</blueprint>
\ No newline at end of file
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.features/src/main/feature/feature.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.features/src/main/feature/feature.xml
index 0f9aabe169..126dbe9764 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.features/src/main/feature/feature.xml
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.features/src/main/feature/feature.xml
@@ -21,10 +21,18 @@
<feature name='${project.artifactId}' description='${project.name}' version='${project.version}'>
<details>${project.description}</details>
<!-- <config>foo=bar</config> -->
- <bundle>wrap:mvn:org.osgi/org.osgi.service.device/1.1.0/$Export-Package=*;version="1.1.0",!*</bundle>
+ <bundle>wrap:mvn:org.osgi/org.osgi.service.device/1.1.0/$Export-Package=*;version="1.1.0",!*</bundle>
+
<!-- Karaf branding bundle -->
<bundle start-level="10">wrap:mvn:org.apache.plc4x.merlot.branding/org.apache.plc4x.merlot.branding/${project.version}/$Bundle-SymbolicName=plc4x-branding&Bundle-Version=${project.version}&Export-Package=*;version="${project.version}",!*</bundle>
+
+ <!-- Karaf support library -->
<bundle start-level="30">wrap:mvn:org.apache.karaf/org.apache.karaf.util/${karaf.version}/$Export-Package=*;version="${karaf.version}",!*</bundle>
+ <bundle start-level="30">wrap:mvn:org.apache.karaf.shell/org.apache.karaf.shell.console/${karaf.version}/$Export-Package=*;version="${karaf.version}",!*</bundle>
+
+ <!-- Mandatory librarys -->
+
+ <bundle start-level="30">wrap:mvn:org.apache.commons/commons-lang3/${commons-lang3.version}/$Export-Package=*;version="${commons-lang3.version}",!*</bundle>
<bundle start-level="32">wrap:mvn:io.netty/netty-buffer/${netty.version}/$Bundle-SymbolicName=netty-buffer&Bundle-Version=${netty.version}&Export-Package=*;version="${netty.version}",!*</bundle>
<bundle start-level="32">wrap:mvn:io.netty/netty-common/${netty.version}/$Bundle-SymbolicName=netty-common&Bundle-Version=${netty.version}&Export-Package=*;version="${netty.version}",!*</bundle>
<bundle start-level="32">wrap:mvn:io.netty/netty-codec/${netty.version}/$Bundle-SymbolicName=netty-codec&Bundle-Version=${netty.version}&Export-Package=*;version="${netty.version}",!*</bundle>
@@ -32,6 +40,60 @@
<bundle start-level="32">wrap:mvn:io.netty/netty-transport/${netty.version}/$Bundle-SymbolicName=netty-transport&Bundle-Version=${netty.version}&Export-Package=*;version="${netty.version}",!*</bundle>
<bundle start-level="32">wrap:mvn:io.netty/netty-resolver/${netty.version}/$Bundle-SymbolicName=netty-resolver&Bundle-Version=${netty.version}&Export-Package=*;version="${netty.version}",!*</bundle>
<bundle start-level="32">wrap:mvn:io.netty/netty-transport-native-unix-common/${netty.version}/$Bundle-SymbolicName=netty-transport-native-unix-common&Bundle-Version=${netty.version}&Export-Package=*;version="${netty.version}",!*</bundle>
+
+ <bundle start-level="30">wrap:mvn:com.github.jinahya/bit-io/${bit-io.version}/$Export-Package=*;version="${bit-io.version}",!*</bundle>
+ <bundle start-level="30">wrap:mvn:io.vavr/vavr/${vavr.version}/$Export-Package=*;version="${vavr.version}",!*</bundle>
+ <bundle start-level="30">wrap:mvn:io.vavr/vavr-match/${vavr.version}/$Export-Package=*;version="${vavr.version}",!*</bundle>
+ <bundle start-level="30">wrap:mvn:org.json/json/20230618/$Export-Package=*;version="20230618",!*</bundle>
+ <bundle start-level="30">wrap:mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version}/$Export-Package=*;version="${jackson.version}",!*</bundle>
+ <bundle start-level="30">wrap:mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version}/$Export-Package=*;version="${jackson.version}",!*</bundle>
+ <bundle start-level="30">wrap:mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version}/$Export-Package=*;version="${jackson.version}",!*</bundle>
+
+ <bundle start-level="28">mvn:org.apache.aries.spifly/org.apache.aries.spifly.static.bundle/${spifly.version}</bundle>
+
+
+ <bundle start-level="28">mvn:org.ops4j.pax.logging/pax-logging-api/2.2.3</bundle>
+
+ <bundle start-level="28">mvn:commons-codec/commons-codec/1.15</bundle>
+ <bundle start-level="28">mvn:com.lmax/disruptor/3.4.4</bundle>
+ <bundle start-level="28">mvn:org.osgi/org.osgi.service.dal/1.0.2</bundle>
+ <bundle start-level="28">mvn:com.fazecast/jSerialComm/2.10.3</bundle>
+ <bundle start-level="28">mvn:ch.qos.logback/logback-core/1.4.11</bundle>
+ <bundle start-level="32">wrap:mvn:org.pcap4j/pcap4j-core/1.8.2/$Bundle-SymbolicName=pcap4j&Bundle-Version=1.8.2&Bundle-ManifestVersion="2"&Export-Package=*;version="1.8.2",!*</bundle>
+ <bundle start-level="28">mvn:commons-net/commons-net/3.9.0</bundle>
+<!-- <bundle>wrap:mvn:com.zaxxer/HikariCP/${hikaricp.version}/$Export-Package=*;version="${hikaricp.version}",!*</bundle>
+ <bundle>wrap:mvn:com.mchange/c3p0/${c3p0.version}/$Export-Package=*;version="${c3p0.version}",!*</bundle>
+ <bundle>wrap:mvn:org.quartz-scheduler/quartz/${quartz.version}/$Export-Package=*;version="${quartz.version}",!*</bundle>
+ <bundle>wrap:mvn:jakarta.xml.bind/jakarta.xml.bind-api/${jakarta.xml.bind.version}/$Export-Package=*;version="${jakarta.xml.bind.version}",!*</bundle> -->
+
+ <!-- Plc4x - Core -->
+ <bundle start-level="28">mvn:org.apache.plc4x/plc4j-api/${project.version}</bundle>
+ <bundle start-level="30">mvn:org.apache.plc4x/plc4j-spi/${project.version}</bundle>
+ <bundle start-level="30">mvn:org.apache.plc4x/plc4j-osgi/${project.version}</bundle>
+ <bundle start-level="30">mvn:org.apache.plc4x/plc4j-transport-serial/${project.version}</bundle>
+ <bundle start-level="30">mvn:org.apache.plc4x/plc4j-transport-tcp/${project.version}</bundle>
+ <bundle start-level="30">mvn:org.apache.plc4x/plc4j-transport-pcap-replay/${project.version}</bundle>
+ <bundle start-level="30">mvn:org.apache.plc4x/plc4j-transport-pcap-shared/${project.version}</bundle>
+ <bundle start-level="30">mvn:org.apache.plc4x/plc4j-utils-pcap-replay/${project.version}</bundle>
+ <bundle start-level="30">mvn:org.apache.plc4x/plc4j-utils-pcap-shared/${project.version}</bundle>
+ <bundle start-level="30">mvn:org.apache.plc4x/plc4j-transport-raw-socket/${project.version}</bundle>
+ <bundle start-level="30">mvn:org.apache.plc4x/plc4j-utils-raw-sockets/${project.version}</bundle>
+
+ <!-- Plc4x-Merlot-Core>
+ 1. Driver packages must have a "start-level" greater than 40.
+ -->
+ <bundle start-level="30">mvn:org.apache.plc4x.merlot.api/org.apache.plc4x.merlot.api/${project.version}</bundle>
+ <bundle start-level="30">mvn:org.apache.plc4x.merlot.das/org.apache.plc4x.merlot.das/${project.version}</bundle>
+ <bundle start-level="32">mvn:org.apache.plc4x.merlot.das.ref/org.apache.plc4x.merlot.das.ref/${project.version}</bundle>
+ <feature>plc4x_epics_core</feature>
+ <feature>plc4x_scheduler</feature>
+
+ <bundle start-level="40">mvn:org.apache.plc4x.merlot.das.base/org.apache.plc4x.merlot.das.base/${project.version}</bundle>
+ <configfile finalname="/etc/org.apache.plc4x.merlot.das.devices.cfg">mvn:org.apache.plc4x.merlot.das.base/org.apache.plc4x.merlot.das.base/${project.version}/cfg</configfile>
+ <bundle start-level="40">mvn:org.apache.plc4x.dummy/org.apache.plc4x.dummy/${project.version}</bundle>
+
+ <!-- Plc4x - Default driver implementation -->
+ <bundle start-level="40">mvn:org.apache.plc4x/plc4j-driver-simulated/${project.version}</bundle>
</feature>
<!--
@@ -40,7 +102,7 @@
<feature>transaction</feature>
<feature>jndi</feature>
<feature>jdbc</feature>
- <feature>pax-jdbc-config</feature>
+ <feature>pax-jdbc-config</feature>
<feature>pax-jdbc-derby</feature>
<!-- <feature>pax-jdbc-derbyclient</feature> -->
<feature>pax-jdbc-pool-dbcp2</feature>
@@ -67,9 +129,36 @@
osgi.jdbc.driver.name=derby
pool=dbcp2
xa=true
-url=jdbc:derby:data/example/derby;create=true
+url=jdbc:derby:data/derby/uns;create=true
dataSourceName=uns
</config>
+
+ <config name="org.ops4j.datasource-derby-rtdb-example">
+################################################################################
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+################################################################################
+osgi.jdbc.driver.name=derby
+pool=dbcp2
+xa=true
+url=jdbc:derby:data/derby/rtdb;create=true
+dataSourceName=uns
+ </config>
+
<!--
<config name="org.apache.karaf.examples.jdbc">
###############################################
@@ -84,7 +173,20 @@ dataSourceName=uns
# Supported dialects are: generic, derby, mysql
dialect=derby
</config>
- -->
+ -->
+ <!--
+ <bundle>mvn:org.apache.derby/derbyrun/${derby.version}</bundle>
+ <bundle>mvn:org.apache.derby/derby/${derby.version}</bundle>
+ <bundle>mvn:org.apache.derby/derbyclient/${derby.version}</bundle>
+ <bundle>mvn:org.ops4j.pax.jdbc/pax-jdbc-derbyclient/1.5.5</bundle>
+
+ <bundle>wrap:mvn:org.apache.derby/derbyLocale_es/${derby.version}/$Export-Package=*;version="${derby.version}",!*</bundle>
+
+ <bundle start-level="32">wrap:mvn:org.apache.derby/derby/${derby.version}/$Bundle-SymbolicName=derby&Bundle-Version=${derby.version}&Bundle-ManifestVersion="2"&Export-Package=*;version="${derby.version}",!*</bundle>
+
+ <bundle start-level="36">wrap:mvn:org.apache.derby/derbynet/${derby.version}/$Bundle-SymbolicName=derbynet&Bundle-Version=${derby.version}&Bundle-ManifestVersion="2"&Export-Package=*;version="${derby.version}"&Import-Package=*,!*</bundle>
+ <bundle start-level="50">mvn:org.apache.plc4x.merlot.derby/org.apache.plc4x.merlot.derby/${project.version}</bundle>
+ -->
</feature>
<feature name='plc4x_h2' description='${project.name}' version='${project.version}'>
@@ -117,13 +219,106 @@ dataSourceName=uns
osgi.jdbc.driver.name=H2 JDBC Driver
pool=dbcp2
xa=true
-url=jdbc:h2:file:./model
+url=jdbc:h2:file:./data/h2/uns
dataSourceName=uns
</config>
+
+
+ <config name="org.ops4j.datasource-h2-rtdb-example">
+################################################################################
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+################################################################################
+osgi.jdbc.driver.name=H2 JDBC Driver
+pool=dbcp2
+xa=true
+url=jdbc:h2:file:./data/h2/rtdb
+dataSourceName=rtdb
+ </config>
+
</feature>
+
+
+ <feature name='plc4x_h2_svr' description='${project.name}' version='${project.version}'>
+ <feature>transaction</feature>
+ <feature>jndi</feature>
+ <feature>jdbc</feature>
+ <feature>pax-jdbc-h2</feature>
+ <feature>pax-jdbc-pool-dbcp2</feature>
+ <feature>pax-jdbc-config</feature>
+
+ <config name="org.ops4j.datasource-h2-uns-example">
+################################################################################
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+################################################################################
+osgi.jdbc.driver.name=H2 JDBC Driver
+pool=dbcp2
+xa=true
+url= jdbc:h2:tcp://localhost/uns
+dataSourceName=uns
+ </config>
+
+
+ <config name="org.ops4j.datasource-h2-rtdb-example">
+################################################################################
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+################################################################################
+osgi.jdbc.driver.name=H2 JDBC Driver
+pool=dbcp2
+xa=true
+url= jdbc:h2:tcp://localhost/rtdb
+dataSourceName=rtdb
+ </config>
+
+ <bundle start-level="50">mvn:org.apache.plc4x.merlot.h2/org.apache.plc4x.merlot.h2/${project.version}</bundle>
+ </feature>
+
<feature name='plc4x_epics_core' description='${project.name}' version='${project.version}'>
- <!-- <bundle>wrap:mvn:org.glassfish.corba/glassfish-corba-omgapi/4.2.2/$Export-Package=*;version="4.2.2",!*</bundle> -->
<bundle>wrap:mvn:org.epics/epics-util/${epics.util.version}/$Export-Package=*;version="${epics.util.version}",!*</bundle>
<bundle>wrap:mvn:org.epics/epics-pvdata/${epics.pvdata.version}/$Export-Package=*;veplc4j-spirsion="${epics.pvdata.version}",!*</bundle>
<bundle>wrap:mvn:org.epics/epics-ntypes/${epics.ntypes.version}/$Export-Package=*;version="${epics.ntypes.version}",!*</bundle>
@@ -145,19 +340,12 @@ dataSourceName=uns
<feature name='plc4x_uns' description='${project.name}' version='${project.version}'>
<feature>plc4x_epics_core</feature>
- <feature>plc4x_h2</feature>
-
- <!--
- <bundle>wrap:mvn:org.slf4j/slf4j-api/1.7.32/$Export-Package=*;version="1.7.32",!*</bundle>
- <bundle>wrap:mvn:org.slf4j/slf4j-nop/${slf4j.version}/$Export-Package=*;version="${slf4j.version}",!*</bundle>
- <bundle>wrap:mvn:org.slf4j/log4j-over-slf4j/${slf4j.version}/$Export-Package=*;version="${slf4j.version}",!*</bundle>
- -->
+
<bundle start-level="80">wrap:mvn:org.apache.plc4x.merlot.uns/org.apache.plc4x.merlot.uns/${project.version}/$Export-Package=*;version="${project.version}",!*</bundle>
<configfile finalname="/etc/org.apache.plc4x.merlot.uns.cfg">mvn:org.apache.plc4x.merlot.uns/org.apache.plc4x.merlot.uns/${project.version}/cfg</configfile>
</feature>
<feature name='plc4x_scheduler' description='${project.name}' version='${project.version}'>
-<!-- <bundle start-level="30">wrap:mvn:org.apache.karaf/org.apache.karaf.util/${karaf.version}/$Export-Package=*;version="${karaf.version}",!*</bundle> -->
<bundle>wrap:mvn:com.zaxxer/HikariCP/${hikaricp.version}/$Export-Package=*;version="${hikaricp.version}",!*</bundle>
<bundle>wrap:mvn:com.mchange/c3p0/${c3p0.version}/$Export-Package=*;version="${c3p0.version}",!*</bundle>
<bundle>wrap:mvn:org.quartz-scheduler/quartz/${quartz.version}/$Export-Package=*;version="${quartz.version}",!*</bundle>
@@ -183,6 +371,18 @@ dataSourceName=uns
<bundle start-level="30">wrap:mvn:com.github.gbenroscience/parser-ng/${parser-ng.version}/$Export-Package=*;version="${parser-ng.version}",!*</bundle>
<bundle start-level="50">mvn:org.apache.plc4x.merlot.modbus.sim/org.apache.plc4x.merlot.modbus.sim/${project.version}</bundle>
<configfile finalname="/etc/org.apache.plc4x.merlot.modbus.sim.cfg">mvn:org.apache.plc4x.merlot.modbus.sim/org.apache.plc4x.merlot.modbus.sim/${project.version}/cfg</configfile>
- </feature>
+ </feature>
+
+ <feature name='plc4x_modbus_drv' description='${project.name}' version='${project.version}'>
+ <bundle start-level="40">mvn:org.apache.plc4x/plc4j-driver-modbus/${project.version}</bundle>
+ </feature>
+
+ <feature name='plc4x_s7_drv' description='${project.name}' version='${project.version}'>
+ <bundle start-level="40">mvn:org.apache.plc4x/plc4j-driver-s7/${project.version}</bundle>
+ </feature>
+ <feature name='plc4x_activemq' description='${project.name}' version='${project.version}'>
+ <bundle start-level="30">mvn:org.apache.activemq/artemis-features/2.30.0</bundle>
+ </feature>
+
</features>
\ No newline at end of file
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/pom.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.h2/pom.xml
similarity index 69%
copy from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/pom.xml
copy to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.h2/pom.xml
index 1e1eb98008..f7056ad45e 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.das.api/pom.xml
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.h2/pom.xml
@@ -26,13 +26,13 @@
<version>0.11.0-SNAPSHOT</version>
</parent>
- <groupId>org.apache.plc4x.merlot.das.api</groupId>
- <artifactId>org.apache.plc4x.merlot.das.api</artifactId>
+ <groupId>org.apache.plc4x.merlot.h2</groupId>
+ <artifactId>org.apache.plc4x.merlot.h2</artifactId>
<version>0.11.0-SNAPSHOT</version>
<packaging>bundle</packaging>
- <name>PLC4J: Merlot :: api :: OSGi Device access</name>
- <description>org.apache.plc4x.merlot.das.api OSGi blueprint bundle project.</description>
+ <name>PLC4J: Merlot :: db :: H2 Tcp Server</name>
+ <description>org.apache.plc4x.merlot.h2 OSGi blueprint bundle project.</description>
<build>
<plugins>
@@ -45,7 +45,7 @@
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
- <Export-Package>org.apache.plc4x.merlot.das.api*;version=${project.version}</Export-Package>
+ <Export-Package>org.apache.plc4x.merlot.h2*;version=${project.version}</Export-Package>
<Import-Package>*</Import-Package>
</instructions>
</configuration>
@@ -61,26 +61,5 @@
</plugin>
</plugins>
</build>
- <dependencies>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-buffer</artifactId>
- <version>${netty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-api</artifactId>
- <version>0.11.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>osgi.cmpn</artifactId>
- <version>${osgi.cmpn.version}</version>
- </dependency>
- <dependency>
- <groupId>com.lmax</groupId>
- <artifactId>disruptor</artifactId>
- <version>${disruptor.version}</version>
- </dependency>
- </dependencies>
+
</project>
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.h2/src/main/java/org/apache/plc4x/merlot/h2/MyService.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.h2/src/main/java/org/apache/plc4x/merlot/h2/MyService.java
new file mode 100644
index 0000000000..9653ab6aff
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.h2/src/main/java/org/apache/plc4x/merlot/h2/MyService.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.h2;
+
+public interface MyService {
+
+ public String echo(String message);
+
+}
\ No newline at end of file
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.h2/src/main/java/org/apache/plc4x/merlot/h2/MyServiceImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.h2/src/main/java/org/apache/plc4x/merlot/h2/MyServiceImpl.java
new file mode 100644
index 0000000000..aca87e4cc4
--- /dev/null
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.h2/src/main/java/org/apache/plc4x/merlot/h2/MyServiceImpl.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.plc4x.merlot.h2;
+
+public class MyServiceImpl implements MyService {
+
+ public String echo(String message) {
+ return "Echo processed: " + message;
+ }
+
+}
\ No newline at end of file
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.uns/src/main/resources/OSGI-INF/blueprint/uns-service.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.h2/src/main/resources/OSGI-INF/blueprint/h2-svr-service.xml
similarity index 57%
copy from plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.uns/src/main/resources/OSGI-INF/blueprint/uns-service.xml
copy to plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.h2/src/main/resources/OSGI-INF/blueprint/h2-svr-service.xml
index a9d6d075b8..c718f50b2a 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.uns/src/main/resources/OSGI-INF/blueprint/uns-service.xml
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.h2/src/main/resources/OSGI-INF/blueprint/h2-svr-service.xml
@@ -15,8 +15,13 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="eager">
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
+ <!--
+ <bean id="serviceBean" class="org.apache.plc4x.merlot.h2.MyServiceImpl"/>
+ <service ref="serviceBean" interface="org.apache.plc4x.merlot.h2.MyService"/>
+ -->
+
<bean id = "H2ServerFactory"
scope="singleton"
@@ -31,7 +36,7 @@
<value>-tcpAllowOthers</value>
<value>-webAllowOthers</value>
<value>-tcpPort</value>
- <value>8143</value>
+ <value>9092</value>
<value>-webPort</value>
<value>8282</value>
<value>-baseDir</value>
@@ -53,7 +58,7 @@
<value>-tcpAllowOthers</value>
<value>-webAllowOthers</value>
<value>-tcpPort</value>
- <value>8143</value>
+ <value>9092</value>
<value>-webPort</value>
<value>8282</value>
<value>-baseDir</value>
@@ -80,59 +85,4 @@
activation="eager">
</bean>
- <reference id="configRepository"
- interface="org.apache.karaf.config.core.ConfigRepository"
- availability="mandatory"
- timeout="30000"/>
-
- <bean id="MerlotModelManagedService"
- class="org.apache.plc4x.merlot.uns.core.ModelManagedService"
- scope="singleton">
- </bean>
-
- <bean id="MerlotModel"
- class="org.apache.plc4x.merlot.uns.impl.ModelImpl"
- scope="singleton"
- init-method="init" destroy-method="destroy">
- <argument ref="blueprintBundleContext"/>
- <argument ref="configRepository"/>
- </bean>
-
- <bean id="MerlotModelMBean"
- class="org.apache.plc4x.merlot.uns.impl.ModelMBeanImpl"
- scope="singleton">
- <argument ref="MerlotModel" />
- </bean>
-
- <bean id="MerlotModelRPCService"
- class="org.apache.plc4x.merlot.uns.core.ModelRPCService"
- scope="singleton"
- factory-method="create">
- <argument ref="MerlotModel" />
- </bean>
-
- <service ref="MerlotModelManagedService" auto-export="interfaces">
- <service-properties>
- <entry key="service.pid" value="org.apache.plc4x.merlot.uns"/>
- </service-properties>
- </service>
-
- <service ref="MerlotModel" interface="org.apache.plc4x.merlot.uns.api.Model"/>
-
- <service ref="MerlotModelMBean"
- interface="org.apache.plc4x.merlot.uns.api.ModelMBean">
- <service-properties>
- <entry key="jmx.objectname"
- value="org.apache.plc4x.merlot:type=model,name=org.apache.plc4x.model.service,id=model"/>
- </service-properties>
- </service>
-
- <service ref="MerlotModelRPCService"
- auto-export="interfaces">
- <service-properties>
- <entry key="pvservice.id"
- value="model"/>
- </service-properties>
- </service>
-
</blueprint>
\ No newline at end of file
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.scheduler/pom.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.scheduler/pom.xml
index 8b81f1e583..45fc47b18e 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.scheduler/pom.xml
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.scheduler/pom.xml
@@ -31,7 +31,7 @@
<version>0.11.0-SNAPSHOT</version>
<packaging>bundle</packaging>
- <name>PLC4J: Merlot :: scheluder :: Scheduler whiteboard (mseg)</name>
+ <name>PLC4J: Merlot :: scheluder :: Scheduler in mseg</name>
<description>org.apache.plc4x.merlot.scheduler OSGi blueprint bundle project.</description>
<build>
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.scheduler/src/main/java/org/apache/plc4x/merlot/scheduler/impl/SchedulerWhiteBoardImpl.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.scheduler/src/main/java/org/apache/plc4x/merlot/scheduler/impl/SchedulerWhiteBoardImpl.java
index 2260d5b87a..a939c6fa80 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.scheduler/src/main/java/org/apache/plc4x/merlot/scheduler/impl/SchedulerWhiteBoardImpl.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.scheduler/src/main/java/org/apache/plc4x/merlot/scheduler/impl/SchedulerWhiteBoardImpl.java
@@ -112,7 +112,6 @@ public class SchedulerWhiteBoardImpl implements SchedulerWhiteBoard {
immediate = Boolean.valueOf((String) ref.getProperty(Scheduler.PROPERTY_SCHEDULER_IMMEDIATE));
}
}
- System.out.println("Paso por aqui....: " + period);
final Date date = new Date();
if (!immediate) {
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.uns/src/main/java/org/apache/plc4x/merlot/uns/core/ModelManagedService.java b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.uns/src/main/java/org/apache/plc4x/merlot/uns/core/ModelManagedService.java
index e221cf4fb8..6331a29a4b 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.uns/src/main/java/org/apache/plc4x/merlot/uns/core/ModelManagedService.java
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.uns/src/main/java/org/apache/plc4x/merlot/uns/core/ModelManagedService.java
@@ -30,8 +30,9 @@ public class ModelManagedService implements ManagedService {
private static final Logger LOGGER = LoggerFactory.getLogger(ModelManagedService.class);
@Override
- public void updated(Dictionary<String, ?> properties) throws ConfigurationException {
- LOGGER.info("Model update.");
+ public void updated(Dictionary props) throws ConfigurationException {
+ if (null == props) return;
+ LOGGER.info(">>> Model update.");
}
}
diff --git a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.uns/src/main/resources/OSGI-INF/blueprint/uns-service.xml b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.uns/src/main/resources/OSGI-INF/blueprint/uns-service.xml
index a9d6d075b8..50ba271b6d 100644
--- a/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.uns/src/main/resources/OSGI-INF/blueprint/uns-service.xml
+++ b/plc4j/integrations/plc4j-apache-karaf/org.apache.plc4x.merlot.uns/src/main/resources/OSGI-INF/blueprint/uns-service.xml
@@ -17,68 +17,6 @@
-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="eager">
-
- <bean id = "H2ServerFactory"
- scope="singleton"
- class="org.h2.tools.Server"
- factory-method="createTcpServer"
- activation="eager">
- <argument>
- <array>
- <!-- <value>-trace</value> -->
- <value>-tcp</value>
- <value>-web</value>
- <value>-tcpAllowOthers</value>
- <value>-webAllowOthers</value>
- <value>-tcpPort</value>
- <value>8143</value>
- <value>-webPort</value>
- <value>8282</value>
- <value>-baseDir</value>
- <value>./data/h2</value>
- </array>
- </argument>
- </bean>
-
- <bean id = "H2WebServerFactory"
- scope="singleton"
- class="org.h2.tools.Server"
- factory-method="createWebServer"
- activation="eager">
- <argument>
- <array>
- <!-- <value>-trace</value> -->
- <value>-tcp</value>
- <value>-web</value>
- <value>-tcpAllowOthers</value>
- <value>-webAllowOthers</value>
- <value>-tcpPort</value>
- <value>8143</value>
- <value>-webPort</value>
- <value>8282</value>
- <value>-baseDir</value>
- <value>./data/h2</value>
- </array>
- </argument>
- </bean>
-
- <bean id = "H2TcpServer"
- scope="singleton"
- class="org.h2.tools.Server"
- factory-ref="H2ServerFactory"
- factory-method="start"
- destroy-method="stop"
- activation="eager">
- </bean>
-
- <bean id = "H2WebServer"
- scope="singleton"
- class="org.h2.tools.Server"
- factory-ref="H2WebServerFactory"
- factory-method="start"
- destroy-method="stop"
- activation="eager">
- </bean>
<reference id="configRepository"
interface="org.apache.karaf.config.core.ConfigRepository"
diff --git a/plc4j/integrations/plc4j-apache-karaf/pom.xml b/plc4j/integrations/plc4j-apache-karaf/pom.xml
index b3940461a9..5af1e70608 100644
--- a/plc4j/integrations/plc4j-apache-karaf/pom.xml
+++ b/plc4j/integrations/plc4j-apache-karaf/pom.xml
@@ -1,95 +1,744 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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
- https://www.apache.org/licenses/LICENSE-2.0
+ https://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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
+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.
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+
+
+
+
+
+
+
+
+
+
+
<modelVersion>4.0.0</modelVersion>
-
- <!--
+
+
+
+
+
+
+
+
+
+
+
+ <!--
<parent>
<groupId>org.apache.plc4x</groupId>
<artifactId>plc4j-integrations</artifactId>
<version>0.11.0-SNAPSHOT</version>
</parent>
-->
+
+
+
+
+
+
+
+
+
+
+
+
+ <groupId>org.apache.plc4x</groupId>
+
+
+
+
+
+
+
+
+
+ <artifactId>plc4j-apache-karaf</artifactId>
+
+
+
+
+
+
+
+
+
+ <version>0.11.0-SNAPSHOT</version>
+
+
+
+
+
+
+
+
+
+ <packaging>pom</packaging>
+
+
+
+
+
+
+
+
+
+
+ <name>PLC4J: Integrations: Apache Karaf</name>
+
+
+
+
+
+
+
+
+
+ <description>Integration module for integrating PLC4X into Apache Karaf.</description>
+
+
+
+
+
+
+
+
+
+ <properties>
+
+
+
+
+
+
+
+
+
+ <!-- Inherited -->
+
+
+
+
+
+
+
+
+ <apache.log4j.version>2.20.0</apache.log4j.version>
+
+
+
+
+
+
+
+
+
+ <bit-io.version>1.4.3</bit-io.version>
+
+
+
+
+
+
+
+
+
+ <c3p0.version>0.9.5.5</c3p0.version>
+
+
+
+
+
+
+
+
+
+ <commons-lang3.version>3.12.0</commons-lang3.version>
+
+
+
+
+
+
+
+
+
+ <hikaricp.version>2.7.9</hikaricp.version>
+
+
+
+
+
+
+
+
+
+ <netty.version>4.1.95.Final</netty.version>
+
+
+
+
+
+
+
+
+
+ <quartz.version>2.3.2</quartz.version>
+
+
+
+
+
+
+
+
+
+ <slf4j.version>2.0.3</slf4j.version>
+
+
+
+
+
+
+
+
+ <spifly.version>1.3.6</spifly.version>
+
+
+
+
+
+
+
+
+
+ <jackson.version>2.15.2</jackson.version>
+
+
+
+
+
+
+
+
+
+ <jakarta.xml.bind.version>2.3.3</jakarta.xml.bind.version>
+
+
+
+
+
+
+
+
+ <parser-ng.version>0.1.8</parser-ng.version>
+
+
+
+
+
+
+
+
+
+ <vavr.version>0.10.4</vavr.version>
+
+
+
+
+
+
+
+
+
+
+
+ <!-- Database used in Pax-jdbc -->
+
+
+
+
+
+
+
+
+
+ <derby.version>10.14.2.0</derby.version>
+
+
+
+
+
+
+
+
+
+ <h2.version>2.1.210</h2.version>
+
+
+
+
+
+
+
+
+
+
+ <!-- Remove GPL licence -->
+
+
+
+
+
+
+
+
+
+ <javaluator.version>3.0.3</javaluator.version>
+
+
+
+
+
+
+
+
+
+
+
+ <!-- Integration version -->
+
+
+
+
+
+
+
+
+
+ <karaf.version>4.4.3</karaf.version>
+
+
+
+
+
+
+
+
+
+ <org.osgi.core.version>6.0.0</org.osgi.core.version>
+
+
+
+
+
+
+
+
+
+ <osgi.core.version>8.0.0</osgi.core.version>
+
+
+
+
+
+
+
+
+
+ <osgi.cmpn.version>7.0.0</osgi.cmpn.version>
+
+
+
+
+
+
+
+
+
+ <osgi.device.version>1.1.0</osgi.device.version>
+
+
+
+
+
+
+
+
+
+ <disruptor.version>3.4.4</disruptor.version>
+
+
+
+
+
+
+
+
+
+ <!-- EPICS -->
+
+
+
+
+
+
+
+
+
+ <epics.core.version>7.0.9</epics.core.version>
+
+
+
+
+
+
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-apache-karaf</artifactId>
- <version>0.11.0-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>PLC4J: Integrations: Apache Karaf</name>
- <description>Integration module for integrating PLC4X into Apache Karaf.</description>
+
+ <epics.util.version>1.0.6</epics.util.version>
+
+
+
+
+
+
+
+
+
+ <epics.vtype.version>1.0.6</epics.vtype.version>
+
+
+
+
+
+
+
+
+
+ <epics.vtype.all.version>1.0.6</epics.vtype.all.version>
+
+
+
+
+
+
+
+
+
+ <epics.ntypes.version>0.3.8</epics.ntypes.version>
+
+
+
+
+
+
+
+
+
+ <epics.jca.version>2.4.8</epics.jca.version>
+
+
+
+
+
+
+
+
+
+ <epics.pvaccess.version>5.1.8</epics.pvaccess.version>
+
+
+
+
+
+
+
+
+
+ <epics.pvaclient.version>4.3.2</epics.pvaclient.version>
+
+
+
+
+
+
+
+
+
+ <epics.pvdata.version>6.1.8</epics.pvdata.version>
+
+
+
+
+
+
+
+
+
+ <epics.pvdatabase.version>4.3.1</epics.pvdatabase.version>
+
+
+
+
+
+
+
+
+
+ <epics.gpclient.version>1.0.7</epics.gpclient.version>
+
+
+
+
+
+
+
+
+
+ <epics.gpclient.core.version>1.0.7</epics.gpclient.core.version>
+
+
+
+
+
+
+
+
+
+ <epics.gpclient.sim.version>1.0.7</epics.gpclient.sim.version>
+
+
+
+
+
+
+
+
+
+ <epics.gpclient.loc.version>1.0.7</epics.gpclient.loc.version>
+
+
+
+
+
+
+
+
+
+ <epics.gpclient.pva.version>1.0.7</epics.gpclient.pva.version>
+
+
+
+
+
+
+
+
+
+ <epics.gpclient.ca.version>1.0.7</epics.gpclient.ca.version>
+
+
+
+
+
+
+
+
+
+ </properties>
+
+
+
+
+
+
+
+
+
+
+
+ <modules>
+
+
+
+
+
+
+
+
+
+ <module>org.apache.plc4x.merlot</module>
+
+
+
+
+
+
+
+
+
+ <module>org.apache.plc4x.merlot.modbus.dev</module>
+
+
+
+
+
+
+
+
+
+ <module>org.apache.plc4x.merlot.modbus.svr</module>
+
+
+
+
+
+
+
+
+
+ <module>org.apache.plc4x.merlot.scheduler</module>
+
+
+
+
+
+
+
+
+
+ <module>org.apache.plc4x.merlot.branding</module>
+
+
+
+
+
+
+
+
+
+ <module>org.apache.plc4x.merlot.uns</module>
+
+
+
+
+
+
+
+
+
+ <module>org.apache.plc4x.merlot.features</module>
+
+
+
+
+
+
+
+
+
+ <module>org.apache.plc4x.merlot.das</module>
+
+
+
+
+
+
+
+
+
+ <module>org.apache.plc4x.merlot.modbus.sim</module>
+
+
+
+
+
+
+
+
+
+ <module>org.apache.plc4x.merlot.db</module>
+
+
+
+
+
+
+
+
+
+ <module>org.apache.plc4x.merlot.das.api</module>
+
+
+
+
+
+
+
+
+
+ <module>org.apache.plc4x.merlot.derby</module>
+
+
+
+
+
+
+
+
+
+ <module>org.apache.plc4x.merlot.h2</module>
+
+
+
+
+
+
+
+
+
+
+ <module>org.apache.plc4x.merlot.drv.simulated</module>
+
+
+
+
+
+
+
+ <module>org.apache.plc4x.merlot.das.ref</module>
+
+
+ <module>org.apache.plc4x.merlot.das.base</module>
+
+ </modules>
+
+
+
+
+
+
+
- <properties>
- <!-- Inherited -->
- <netty.version>4.1.95.Final</netty.version>
- <slf4j.version>1.7.32</slf4j.version>
- <quartz.version>2.3.2</quartz.version>
- <c3p0.version>0.9.5.5</c3p0.version>
- <hikaricp.version>2.7.9</hikaricp.version>
- <parser-ng.version>0.1.8</parser-ng.version>
-
- <!-- Integration version -->
- <karaf.version>4.4.3</karaf.version>
- <org.osgi.core.version>6.0.0</org.osgi.core.version>
- <osgi.core.version>8.0.0</osgi.core.version>
- <osgi.cmpn.version>7.0.0</osgi.cmpn.version>
- <osgi.device.version>1.1.0</osgi.device.version>
- <disruptor.version>3.4.4</disruptor.version>
- <!-- EPICS -->
- <epics.core.version>7.0.9</epics.core.version>
- <epics.util.version>1.0.6</epics.util.version>
- <epics.vtype.version>1.0.6</epics.vtype.version>
- <epics.vtype.all.version>1.0.6</epics.vtype.all.version>
- <epics.ntypes.version>0.3.8</epics.ntypes.version>
- <epics.jca.version>2.4.8</epics.jca.version>
- <epics.pvaccess.version>5.1.8</epics.pvaccess.version>
- <epics.pvaclient.version>4.3.2</epics.pvaclient.version>
- <epics.pvdata.version>6.1.8</epics.pvdata.version>
- <epics.pvdatabase.version>4.3.1</epics.pvdatabase.version>
- <epics.gpclient.version>1.0.7</epics.gpclient.version>
- <epics.gpclient.core.version>1.0.7</epics.gpclient.core.version>
- <epics.gpclient.sim.version>1.0.7</epics.gpclient.sim.version>
- <epics.gpclient.loc.version>1.0.7</epics.gpclient.loc.version>
- <epics.gpclient.pva.version>1.0.7</epics.gpclient.pva.version>
- <epics.gpclient.ca.version>1.0.7</epics.gpclient.ca.version>
-
- <!-- -->
- <javaluator.version>3.0.3</javaluator.version>
- <jakarta.xml.bind.version>2.3.3</jakarta.xml.bind.version>
- </properties>
- <modules>
- <module>org.apache.plc4x.merlot</module>
- <module>org.apache.plc4x.merlot.modbus.dev</module>
- <module>org.apache.plc4x.merlot.modbus.svr</module>
- <module>org.apache.plc4x.merlot.scheduler</module>
- <module>org.apache.plc4x.merlot.branding</module>
- <module>org.apache.plc4x.merlot.uns</module>
- <module>org.apache.plc4x.merlot.features</module>
- <module>org.apache.plc4x.merlot.das</module>
- <module>org.apache.plc4x.merlot.modbus.sim</module>
- <module>org.apache.plc4x.merlot.db</module>
- <module>org.apache.plc4x.merlot.das.api</module>
- <module>org.apache.plc4x.merlot.das.base</module>
- </modules>
</project>
diff --git a/pom.xml b/pom.xml
index 630dac0799..95e5000ef6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -475,11 +475,13 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${slf4j.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
diff --git a/src/site/asciidoc/images/s7h_image01.png b/src/site/asciidoc/images/s7h_image01.png
new file mode 100644
index 0000000000..deba589821
Binary files /dev/null and b/src/site/asciidoc/images/s7h_image01.png differ
diff --git a/src/site/asciidoc/images/s7h_image02.png b/src/site/asciidoc/images/s7h_image02.png
new file mode 100644
index 0000000000..b402e4b77c
Binary files /dev/null and b/src/site/asciidoc/images/s7h_image02.png differ
diff --git a/src/site/asciidoc/images/s7h_image03.png b/src/site/asciidoc/images/s7h_image03.png
new file mode 100644
index 0000000000..4664b98f07
Binary files /dev/null and b/src/site/asciidoc/images/s7h_image03.png differ
diff --git a/src/site/asciidoc/images/s7h_image04.png b/src/site/asciidoc/images/s7h_image04.png
new file mode 100644
index 0000000000..e17a51fe75
Binary files /dev/null and b/src/site/asciidoc/images/s7h_image04.png differ
diff --git a/src/site/asciidoc/images/s7h_image05.png b/src/site/asciidoc/images/s7h_image05.png
new file mode 100644
index 0000000000..b5ddb39331
Binary files /dev/null and b/src/site/asciidoc/images/s7h_image05.png differ
diff --git a/src/site/asciidoc/images/s7h_image06.png b/src/site/asciidoc/images/s7h_image06.png
new file mode 100644
index 0000000000..87e894b0c0
Binary files /dev/null and b/src/site/asciidoc/images/s7h_image06.png differ
diff --git a/src/site/asciidoc/images/s7h_image07.png b/src/site/asciidoc/images/s7h_image07.png
new file mode 100644
index 0000000000..937a8ffd44
Binary files /dev/null and b/src/site/asciidoc/images/s7h_image07.png differ
diff --git a/src/site/asciidoc/images/s7h_szlxy11demo.png b/src/site/asciidoc/images/s7h_szlxy11demo.png
new file mode 100644
index 0000000000..4c85805895
Binary files /dev/null and b/src/site/asciidoc/images/s7h_szlxy11demo.png differ