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-extras.git
The following commit(s) were added to refs/heads/feature/merlot by this push:
new 6b67a2f We need DataSourceProvider for ClassLoad.
6b67a2f is described below
commit 6b67a2fea373790345bc33d557ec15d2777a8001
Author: César García <[email protected]>
AuthorDate: Fri Mar 20 13:18:13 2026 -0400
We need DataSourceProvider for ClassLoad.
---
.../org.apache.plc4x.merlot.archiver/pom.xml | 5 +
.../MerlotHtc.java} | 37 ++++++-
...va => MerlotDataBrowserIoTDBGetDataPVImpl.java} | 2 +-
...ava => MerlotDataBrowserIoTDBSearchPVImpl.java} | 2 +-
....java => MerlotDataBrowserRTGetDataPVImpl.java} | 2 +-
...l.java => MerlotDataBrowserRTSearchPVImpl.java} | 2 +-
.../merlot/archiver/impl/MerlotHtcRTImpl.java | 112 +++++++++++++++++++++
.../OSGI-INF/blueprint/archiver-service.xml | 40 +++++++-
.../src/main/feature/feature.xml | 3 +-
plc4j/tools/merlot/pom.xml | 12 +--
10 files changed, 198 insertions(+), 19 deletions(-)
diff --git a/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/pom.xml
b/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/pom.xml
index 8662592..e6d00f6 100644
--- a/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/pom.xml
+++ b/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/pom.xml
@@ -191,5 +191,10 @@
<artifactId>iotdb-session</artifactId>
<version>2.0.6</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-collections4</artifactId>
+ <version>4.5.0</version>
+ </dependency>
</dependencies>
</project>
diff --git
a/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserGetDataPVImpl.java
b/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/api/MerlotHtc.java
similarity index 62%
copy from
plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserGetDataPVImpl.java
copy to
plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/api/MerlotHtc.java
index 300fd83..b6434f0 100644
---
a/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserGetDataPVImpl.java
+++
b/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/api/MerlotHtc.java
@@ -14,10 +14,41 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.plc4x.merlot.archiver.impl;
+package org.apache.plc4x.merlot.archiver.api;
-import javax.servlet.http.HttpServlet;
+import org.epics.gpclient.PV;
-public class MerlotDataBrowserGetDataPVImpl extends HttpServlet {
+
+public interface MerlotHtc {
+
+ /*
+ *
+ */
+ public void init();
+
+ /*
+ *
+ */
+ public void destroy();
+
+ /*
+ *
+ */
+ void addPV(String strPV, Double interval);
+
+ /*
+ *
+ */
+ void removePV(String strPV);
+
+ /*
+ *
+ */
+ String[] getPVs();
+
+ /*
+ *
+ */
+ PV[] getPs(String strPV, String init, String end);
}
diff --git
a/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserGetDataPVImpl.java
b/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserIoTDBGetDataPVImpl.java
similarity index 92%
copy from
plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserGetDataPVImpl.java
copy to
plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserIoTDBGetDataPVImpl.java
index 300fd83..3535f9f 100644
---
a/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserGetDataPVImpl.java
+++
b/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserIoTDBGetDataPVImpl.java
@@ -18,6 +18,6 @@ package org.apache.plc4x.merlot.archiver.impl;
import javax.servlet.http.HttpServlet;
-public class MerlotDataBrowserGetDataPVImpl extends HttpServlet {
+public class MerlotDataBrowserIoTDBGetDataPVImpl extends HttpServlet {
}
diff --git
a/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserSearchPVImpl.java
b/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserIoTDBSearchPVImpl.java
similarity index 96%
copy from
plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserSearchPVImpl.java
copy to
plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserIoTDBSearchPVImpl.java
index b28f4e4..47e26b5 100644
---
a/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserSearchPVImpl.java
+++
b/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserIoTDBSearchPVImpl.java
@@ -24,7 +24,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-public class MerlotDataBrowserSearchPVImpl extends HttpServlet {
+public class MerlotDataBrowserIoTDBSearchPVImpl extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
diff --git
a/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserGetDataPVImpl.java
b/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserRTGetDataPVImpl.java
similarity index 92%
rename from
plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserGetDataPVImpl.java
rename to
plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserRTGetDataPVImpl.java
index 300fd83..dc9a21e 100644
---
a/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserGetDataPVImpl.java
+++
b/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserRTGetDataPVImpl.java
@@ -18,6 +18,6 @@ package org.apache.plc4x.merlot.archiver.impl;
import javax.servlet.http.HttpServlet;
-public class MerlotDataBrowserGetDataPVImpl extends HttpServlet {
+public class MerlotDataBrowserRTGetDataPVImpl extends HttpServlet {
}
diff --git
a/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserSearchPVImpl.java
b/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserRTSearchPVImpl.java
similarity index 96%
rename from
plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserSearchPVImpl.java
rename to
plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserRTSearchPVImpl.java
index b28f4e4..330f4c9 100644
---
a/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserSearchPVImpl.java
+++
b/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotDataBrowserRTSearchPVImpl.java
@@ -24,7 +24,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-public class MerlotDataBrowserSearchPVImpl extends HttpServlet {
+public class MerlotDataBrowserRTSearchPVImpl extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
diff --git
a/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotHtcRTImpl.java
b/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotHtcRTImpl.java
new file mode 100644
index 0000000..76e1377
--- /dev/null
+++
b/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/java/org/apache/plc4x/merlot/archiver/impl/MerlotHtcRTImpl.java
@@ -0,0 +1,112 @@
+/*
+ * 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.archiver.impl;
+
+import java.time.Duration;
+import java.time.LocalDateTime;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.regex.Pattern;
+import org.apache.commons.collections4.queue.CircularFifoQueue;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.plc4x.merlot.archiver.api.MerlotHtc;
+import org.epics.gpclient.GPClient;
+import org.epics.gpclient.GPClientConfiguration;
+import org.epics.gpclient.GPClientInstance;
+import org.epics.gpclient.PV;
+import org.epics.gpclient.PVReader;
+import org.epics.gpclient.datasource.DataSourceProvider;
+import org.epics.vtype.VType;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author cgarcia
+ */
+public class MerlotHtcRTImpl implements MerlotHtc{
+ private static final org.slf4j.Logger LOGGER =
LoggerFactory.getLogger(MerlotHtcRTImpl.class);
+
+ private static final Pattern SIM_PATTERN =
Pattern.compile("(^ACK:)((,{0,1}(16#[0-9a-fA-F]{8})(;([0-9a-fA-F]{2})))+)");
+
+ private Map<String, PVReader<VType>> readerPvs = new
ConcurrentHashMap<>();
+ private Map<String, CircularFifoQueue<Pair<LocalDateTime, PV>>> pvs = new
ConcurrentHashMap<>();
+
+ static GPClientInstance gpClient;
+
+ private PVReader<VType> pv1;
+ private PVReader<VType> pv2;
+
+ @Override
+ public void init() {
+
+ gpClient = new
GPClientConfiguration().defaultMaxRate(Duration.ofMillis(50))
+
.notificationExecutor(org.epics.util.concurrent.Executors.localThread())
+ .dataSource(DataSourceProvider.createDataSource())
+
.dataProcessingThreadPool(java.util.concurrent.Executors.newScheduledThreadPool(
+ Math.max(1, Runtime.getRuntime().availableProcessors()
- 1),
+
org.epics.util.concurrent.Executors.namedPool("MerlotHtcRT-Worker ")))
+ .build();
+
+ pv1 = gpClient.read("sim://noise")
+ .addReadListener((event, p) ->{
+ System.out.println(event + " <1> " + p.isConnected() + "
" + p.getValue());
+
+ })
+ .start();
+
+ pv2 = gpClient.read("sim://noise")
+ .addReadListener((event, p) ->{
+ System.out.println(event + " <2> " + p.isConnected() + " "
+ p.getValue());
+
+ })
+ .start();
+
+
+ }
+
+ @Override
+ public void destroy() {
+ try {
+ pv1.close();
+ pv2.close();
+ gpClient.close();
+ } catch (IllegalStateException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void addPV(String strPV, Double interval) {
+ //
+ }
+
+ @Override
+ public void removePV(String strPV) {
+ //
+ }
+
+ @Override
+ public String[] getPVs() {
+ return null;
+ }
+
+ @Override
+ public PV[] getPs(String strPV, String init, String end) {
+ return null;
+ }
+
+}
diff --git
a/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/resources/OSGI-INF/blueprint/archiver-service.xml
b/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/resources/OSGI-INF/blueprint/archiver-service.xml
index d628918..5a50030 100644
---
a/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/resources/OSGI-INF/blueprint/archiver-service.xml
+++
b/plc4j/tools/merlot/org.apache.plc4x.merlot.archiver/src/main/resources/OSGI-INF/blueprint/archiver-service.xml
@@ -28,7 +28,14 @@
<reference
id="refEventAdminService"
- interface="org.osgi.service.event.EventAdmin" availability="mandatory"
timeout="1200"/>
+ interface="org.osgi.service.event.EventAdmin" availability="mandatory"
timeout="1200"/>
+
+<!-- <reference
+ id="refDataSource"
+ interface="org.epics.gpclient.datasource.DataSourceProvider"
+
filter="(.org.apache.aries.spifly.provider.implclass=org.epics.gpclient.datasource.sim.SimulationDataSourceProvider)"
+ availability="mandatory"
+ timeout="5000"/> -->
<bean id="MerlotGPClientBean"
class="org.apache.plc4x.merlot.archiver.impl.MerlotGPClientImpl"
@@ -86,7 +93,15 @@
<argument ref="refSchedulerService" />
<argument ref="refEventAdminService" />
<argument ref="MerlotGPClientBean" />
- </bean>
+ </bean>
+
+ <bean id="MerlotHtcRTBean"
+ class="org.apache.plc4x.merlot.archiver.impl.MerlotHtcRTImpl"
+ init-method="init"
+ destroy-method="destroy"
+ scope="singleton"
+ activation="eager">
+ </bean>
<service ref="MerlotGPClientBean" auto-export="interfaces">
</service>
@@ -133,14 +148,29 @@
<service-properties>
<entry key="service.pid"
value="org.apache.plc4x.merlot.archiver"/>
</service-properties>
- </service>
+ </service>
+
+ <service ref="MerlotHtcRTBean" auto-export="interfaces">
+ <service-properties>
+ <entry key="service.pid"
value="org.apache.plc4x.merlot.archiver.api.MerlotHtc"/>
+ <entry key="alias" value="rt"/>
+ </service-properties>
+ </service>
+
+ <service interface="javax.servlet.Servlet">
+ <service-properties>
+ <entry key="alias" value="/request/iotdb/bpl/searchForPVsRegex"/>
+ <entry key="servlet-name" value="searchForPVsRegex"/>
+ </service-properties>
+ <bean
class="org.apache.plc4x.merlot.archiver.impl.MerlotDataBrowserIoTDBSearchPVImpl"/>
+ </service>
<service interface="javax.servlet.Servlet">
<service-properties>
- <entry key="alias" value="/request/bpl/searchForPVsRegex"/>
+ <entry key="alias" value="/request/iotdb/bpl/searchForPVsRegex"/>
<entry key="servlet-name" value="searchForPVsRegex"/>
</service-properties>
- <bean
class="org.apache.plc4x.merlot.archiver.impl.MerlotDataBrowserSearchPVImpl"/>
+ <bean
class="org.apache.plc4x.merlot.archiver.impl.MerlotDataBrowserRTSearchPVImpl"/>
</service>
</blueprint>
\ No newline at end of file
diff --git
a/plc4j/tools/merlot/org.apache.plc4x.merlot.features/src/main/feature/feature.xml
b/plc4j/tools/merlot/org.apache.plc4x.merlot.features/src/main/feature/feature.xml
index c84412c..38df148 100644
---
a/plc4j/tools/merlot/org.apache.plc4x.merlot.features/src/main/feature/feature.xml
+++
b/plc4j/tools/merlot/org.apache.plc4x.merlot.features/src/main/feature/feature.xml
@@ -57,6 +57,7 @@
<bundle
start-level="28">mvn:commons-net/commons-net/${commons-net.version}</bundle>
+ <bundle
start-level="28">mvn:org.apache.commons/commons-collections4/4.5.0</bundle>
<!--<bundle
start-level="32">wrap:mvn:org.apache.commons/commons-net/${commons-net.version}/$Bundle-SymbolicName=commons-net&Bundle-Version=${commons-net.version}&Export-Package=*;version="${commons-net.version}",!*</bundle>-->
<bundle
start-level="28">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-net/1.4.1_6</bundle>
<bundle
start-level="28">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-io/1.4_3</bundle>
@@ -536,7 +537,7 @@ dataSourceName=rtdb
<feature name='plc4x-epics-gpclient' description='${project.name}'
version='${project.version}'>
<feature>plc4x-epics-core</feature>
- <bundle
start-level="30">wrap:mvn:org.epics/gpclient-core/${epics.gpclient.core.version}/$Export-Package=*;version="${epics.gpclient.core.version}",!*</bundle>
+ <bundle
start-level="80">wrap:mvn:org.epics/gpclient-core/${epics.gpclient.core.version}/$Export-Package=*;version="${epics.gpclient.core.version}",!*</bundle>
<bundle
start-level="30">wrap:mvn:org.epics/gpclient-sim/${epics.gpclient.sim.version}/$Export-Package=*;version="${epics.gpclient.sim.version}",!*</bundle>
<bundle
start-level="30">wrap:mvn:org.epics/gpclient-loc/${epics.gpclient.loc.version}/$Export-Package=*;version="${epics.gpclient.loc.version}",!*</bundle>
<bundle
start-level="30">wrap:mvn:org.epics/gpclient-pva/${epics.gpclient.pva.version}/$Export-Package=*;version="${epics.gpclient.pva.version}",!*</bundle>
diff --git a/plc4j/tools/merlot/pom.xml b/plc4j/tools/merlot/pom.xml
index e1bd14f..9320b4c 100644
--- a/plc4j/tools/merlot/pom.xml
+++ b/plc4j/tools/merlot/pom.xml
@@ -114,12 +114,12 @@ under the License.
<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>
+ <epics.gpclient.version>1.0.8</epics.gpclient.version>
+ <epics.gpclient.core.version>1.0.8</epics.gpclient.core.version>
+ <epics.gpclient.sim.version>1.0.8</epics.gpclient.sim.version>
+ <epics.gpclient.loc.version>1.0.8</epics.gpclient.loc.version>
+ <epics.gpclient.pva.version>1.0.8</epics.gpclient.pva.version>
+ <epics.gpclient.ca.version>1.0.8</epics.gpclient.ca.version>
<!-- GRPC Service -->
<protobuf.version>3.25.3</protobuf.version>