This is an automated email from the ASF dual-hosted git repository.
mikexue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/eventmesh.git
The following commit(s) were added to refs/heads/master by this push:
new b55e6dbf0 [ISSUE #4403] Fix the SPI extension admin-api loading of
storage-plugins (#4404)
b55e6dbf0 is described below
commit b55e6dbf03c99b455c049107998c64c9eb2c29fa
Author: Pil0tXia <[email protected]>
AuthorDate: Mon Aug 28 14:48:18 2023 +0800
[ISSUE #4403] Fix the SPI extension admin-api loading of storage-plugins
(#4404)
* fix: remove knative circulate dependency
* feat: realize knative admin-api
* feat: realize mongodb admin-api
* feat: realize pulsar admin-api
* feat: realize pravega admin-api
* fix: deliver a config to client instead of null
* chore: revert startup plugin config
---
.../eventmesh-storage-knative/build.gradle | 3 -
.../storage/knative/admin/KnativeAdmin.java} | 39 +++++++---
.../storage/knative/admin/KnativeAdminAdaptor.java | 85 ++++++++++++++++++++++
.../eventmesh/org.apache.eventmesh.api.admin.Admin | 16 ++++
.../storage/mongodb/admin/MongodbAdmin.java} | 39 +++++++---
.../storage/mongodb/admin/MongodbAdminAdaptor.java | 85 ++++++++++++++++++++++
.../eventmesh/org.apache.eventmesh.api.admin.Admin | 16 ++++
.../pravega/PravegaStorageResourceServiceImpl.java | 10 ++-
.../PravegaAdmin.java} | 39 +++++++---
.../storage/pravega/admin/PravegaAdminAdaptor.java | 85 ++++++++++++++++++++++
.../eventmesh/org.apache.eventmesh.api.admin.Admin | 16 ++++
.../storage/pulsar/admin/PulsarAdmin.java} | 39 +++++++---
.../storage/pulsar/admin/PulsarAdminAdaptor.java | 85 ++++++++++++++++++++++
.../eventmesh/org.apache.eventmesh.api.admin.Admin | 16 ++++
14 files changed, 528 insertions(+), 45 deletions(-)
diff --git a/eventmesh-storage-plugin/eventmesh-storage-knative/build.gradle
b/eventmesh-storage-plugin/eventmesh-storage-knative/build.gradle
index ae6a36f5d..92d9a8e30 100644
--- a/eventmesh-storage-plugin/eventmesh-storage-knative/build.gradle
+++ b/eventmesh-storage-plugin/eventmesh-storage-knative/build.gradle
@@ -21,9 +21,6 @@ dependencies {
implementation project(":eventmesh-sdks:eventmesh-sdk-java")
testImplementation project(":eventmesh-sdks:eventmesh-sdk-java")
- implementation project(":eventmesh-runtime")
- testImplementation project(":eventmesh-runtime")
-
implementation project(":eventmesh-common")
testImplementation project(":eventmesh-common")
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaStorageResourceServiceImpl.java
b/eventmesh-storage-plugin/eventmesh-storage-knative/src/main/java/org/apache/eventmesh/storage/knative/admin/KnativeAdmin.java
similarity index 51%
copy from
eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaStorageResourceServiceImpl.java
copy to
eventmesh-storage-plugin/eventmesh-storage-knative/src/main/java/org/apache/eventmesh/storage/knative/admin/KnativeAdmin.java
index ab8225c91..86c935a1b 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaStorageResourceServiceImpl.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-knative/src/main/java/org/apache/eventmesh/storage/knative/admin/KnativeAdmin.java
@@ -15,23 +15,42 @@
* limitations under the License.
*/
-package org.apache.eventmesh.storage.pravega;
+package org.apache.eventmesh.storage.knative.admin;
-import org.apache.eventmesh.api.storage.StorageResourceService;
-import org.apache.eventmesh.storage.pravega.client.PravegaClient;
+import org.apache.eventmesh.api.admin.AbstractAdmin;
+import org.apache.eventmesh.api.admin.TopicProperties;
-import lombok.extern.slf4j.Slf4j;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
-@Slf4j
-public class PravegaStorageResourceServiceImpl implements
StorageResourceService {
+import io.cloudevents.CloudEvent;
+
+public class KnativeAdmin extends AbstractAdmin {
+
+ public KnativeAdmin() {
+ super(new AtomicBoolean(false));
+ }
+
+ @Override
+ public List<TopicProperties> getTopic() {
+ // TODO implement admin functions
+ return new ArrayList<>();
+ }
+
+ @Override
+ public void createTopic(String topicName) {
+ }
+
+ @Override
+ public void deleteTopic(String topicName) {
+ }
@Override
- public void init() throws Exception {
- PravegaClient.getInstance().start();
+ public void publish(CloudEvent cloudEvent) throws Exception {
}
@Override
- public void release() throws Exception {
- PravegaClient.getInstance().shutdown();
+ public void shutdown() {
}
}
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-knative/src/main/java/org/apache/eventmesh/storage/knative/admin/KnativeAdminAdaptor.java
b/eventmesh-storage-plugin/eventmesh-storage-knative/src/main/java/org/apache/eventmesh/storage/knative/admin/KnativeAdminAdaptor.java
new file mode 100644
index 000000000..f666e0973
--- /dev/null
+++
b/eventmesh-storage-plugin/eventmesh-storage-knative/src/main/java/org/apache/eventmesh/storage/knative/admin/KnativeAdminAdaptor.java
@@ -0,0 +1,85 @@
+/*
+ * 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.eventmesh.storage.knative.admin;
+
+import org.apache.eventmesh.api.admin.Admin;
+import org.apache.eventmesh.api.admin.TopicProperties;
+
+import java.util.List;
+import java.util.Properties;
+
+import io.cloudevents.CloudEvent;
+
+public class KnativeAdminAdaptor implements Admin {
+
+ private final KnativeAdmin admin;
+
+ public KnativeAdminAdaptor() {
+ admin = new KnativeAdmin();
+ }
+
+ @Override
+ public boolean isStarted() {
+ return admin.isStarted();
+ }
+
+ @Override
+ public boolean isClosed() {
+ return admin.isClosed();
+ }
+
+ @Override
+ public void start() {
+ admin.start();
+ }
+
+ @Override
+ public void shutdown() {
+ admin.shutdown();
+ }
+
+ @Override
+ public void init(Properties properties) throws Exception {
+ admin.init(properties);
+ }
+
+ @Override
+ public List<TopicProperties> getTopic() throws Exception {
+ return admin.getTopic();
+ }
+
+ @Override
+ public void createTopic(String topicName) {
+ admin.createTopic(topicName);
+ }
+
+ @Override
+ public void deleteTopic(String topicName) {
+ admin.deleteTopic(topicName);
+ }
+
+ @Override
+ public List<CloudEvent> getEvent(String topicName, int offset, int length)
throws Exception {
+ return admin.getEvent(topicName, offset, length);
+ }
+
+ @Override
+ public void publish(CloudEvent cloudEvent) throws Exception {
+ admin.publish(cloudEvent);
+ }
+}
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-knative/src/main/resources/META-INF/eventmesh/org.apache.eventmesh.api.admin.Admin
b/eventmesh-storage-plugin/eventmesh-storage-knative/src/main/resources/META-INF/eventmesh/org.apache.eventmesh.api.admin.Admin
new file mode 100644
index 000000000..07c24919a
--- /dev/null
+++
b/eventmesh-storage-plugin/eventmesh-storage-knative/src/main/resources/META-INF/eventmesh/org.apache.eventmesh.api.admin.Admin
@@ -0,0 +1,16 @@
+# 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.
+
+knative=org.apache.eventmesh.storage.knative.admin.KnativeAdminAdaptor
\ No newline at end of file
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaStorageResourceServiceImpl.java
b/eventmesh-storage-plugin/eventmesh-storage-mongodb/src/main/java/org/apache/eventmesh/storage/mongodb/admin/MongodbAdmin.java
similarity index 51%
copy from
eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaStorageResourceServiceImpl.java
copy to
eventmesh-storage-plugin/eventmesh-storage-mongodb/src/main/java/org/apache/eventmesh/storage/mongodb/admin/MongodbAdmin.java
index ab8225c91..b3c54d0c5 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaStorageResourceServiceImpl.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-mongodb/src/main/java/org/apache/eventmesh/storage/mongodb/admin/MongodbAdmin.java
@@ -15,23 +15,42 @@
* limitations under the License.
*/
-package org.apache.eventmesh.storage.pravega;
+package org.apache.eventmesh.storage.mongodb.admin;
-import org.apache.eventmesh.api.storage.StorageResourceService;
-import org.apache.eventmesh.storage.pravega.client.PravegaClient;
+import org.apache.eventmesh.api.admin.AbstractAdmin;
+import org.apache.eventmesh.api.admin.TopicProperties;
-import lombok.extern.slf4j.Slf4j;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
-@Slf4j
-public class PravegaStorageResourceServiceImpl implements
StorageResourceService {
+import io.cloudevents.CloudEvent;
+
+public class MongodbAdmin extends AbstractAdmin {
+
+ public MongodbAdmin() {
+ super(new AtomicBoolean(false));
+ }
+
+ @Override
+ public List<TopicProperties> getTopic() {
+ // TODO implement admin functions
+ return new ArrayList<>();
+ }
+
+ @Override
+ public void createTopic(String topicName) {
+ }
+
+ @Override
+ public void deleteTopic(String topicName) {
+ }
@Override
- public void init() throws Exception {
- PravegaClient.getInstance().start();
+ public void publish(CloudEvent cloudEvent) throws Exception {
}
@Override
- public void release() throws Exception {
- PravegaClient.getInstance().shutdown();
+ public void shutdown() {
}
}
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-mongodb/src/main/java/org/apache/eventmesh/storage/mongodb/admin/MongodbAdminAdaptor.java
b/eventmesh-storage-plugin/eventmesh-storage-mongodb/src/main/java/org/apache/eventmesh/storage/mongodb/admin/MongodbAdminAdaptor.java
new file mode 100644
index 000000000..48b55525d
--- /dev/null
+++
b/eventmesh-storage-plugin/eventmesh-storage-mongodb/src/main/java/org/apache/eventmesh/storage/mongodb/admin/MongodbAdminAdaptor.java
@@ -0,0 +1,85 @@
+/*
+ * 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.eventmesh.storage.mongodb.admin;
+
+import org.apache.eventmesh.api.admin.Admin;
+import org.apache.eventmesh.api.admin.TopicProperties;
+
+import java.util.List;
+import java.util.Properties;
+
+import io.cloudevents.CloudEvent;
+
+public class MongodbAdminAdaptor implements Admin {
+
+ private final MongodbAdmin admin;
+
+ public MongodbAdminAdaptor() {
+ admin = new MongodbAdmin();
+ }
+
+ @Override
+ public boolean isStarted() {
+ return admin.isStarted();
+ }
+
+ @Override
+ public boolean isClosed() {
+ return admin.isClosed();
+ }
+
+ @Override
+ public void start() {
+ admin.start();
+ }
+
+ @Override
+ public void shutdown() {
+ admin.shutdown();
+ }
+
+ @Override
+ public void init(Properties properties) throws Exception {
+ admin.init(properties);
+ }
+
+ @Override
+ public List<TopicProperties> getTopic() throws Exception {
+ return admin.getTopic();
+ }
+
+ @Override
+ public void createTopic(String topicName) {
+ admin.createTopic(topicName);
+ }
+
+ @Override
+ public void deleteTopic(String topicName) {
+ admin.deleteTopic(topicName);
+ }
+
+ @Override
+ public List<CloudEvent> getEvent(String topicName, int offset, int length)
throws Exception {
+ return admin.getEvent(topicName, offset, length);
+ }
+
+ @Override
+ public void publish(CloudEvent cloudEvent) throws Exception {
+ admin.publish(cloudEvent);
+ }
+}
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-mongodb/src/main/resources/META-INF/eventmesh/org.apache.eventmesh.api.admin.Admin
b/eventmesh-storage-plugin/eventmesh-storage-mongodb/src/main/resources/META-INF/eventmesh/org.apache.eventmesh.api.admin.Admin
new file mode 100644
index 000000000..41e799399
--- /dev/null
+++
b/eventmesh-storage-plugin/eventmesh-storage-mongodb/src/main/resources/META-INF/eventmesh/org.apache.eventmesh.api.admin.Admin
@@ -0,0 +1,16 @@
+# 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.
+
+mongodb=org.apache.eventmesh.storage.mongodb.admin.MongodbAdminAdaptor
\ No newline at end of file
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaStorageResourceServiceImpl.java
b/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaStorageResourceServiceImpl.java
index ab8225c91..9e785c5e9 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaStorageResourceServiceImpl.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaStorageResourceServiceImpl.java
@@ -19,19 +19,25 @@ package org.apache.eventmesh.storage.pravega;
import org.apache.eventmesh.api.storage.StorageResourceService;
import org.apache.eventmesh.storage.pravega.client.PravegaClient;
+import org.apache.eventmesh.storage.pravega.config.PravegaStorageConfig;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class PravegaStorageResourceServiceImpl implements
StorageResourceService {
+ /**
+ * Unified configuration class corresponding to pravega-storage.properties
+ */
+ private PravegaStorageConfig pravegaConnectorConfig = new
PravegaStorageConfig();
+
@Override
public void init() throws Exception {
- PravegaClient.getInstance().start();
+ PravegaClient.getInstance(pravegaConnectorConfig).start();
}
@Override
- public void release() throws Exception {
+ public void release() {
PravegaClient.getInstance().shutdown();
}
}
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaStorageResourceServiceImpl.java
b/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/admin/PravegaAdmin.java
similarity index 51%
copy from
eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaStorageResourceServiceImpl.java
copy to
eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/admin/PravegaAdmin.java
index ab8225c91..8f4a87372 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaStorageResourceServiceImpl.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/admin/PravegaAdmin.java
@@ -15,23 +15,42 @@
* limitations under the License.
*/
-package org.apache.eventmesh.storage.pravega;
+package org.apache.eventmesh.storage.pravega.admin;
-import org.apache.eventmesh.api.storage.StorageResourceService;
-import org.apache.eventmesh.storage.pravega.client.PravegaClient;
+import org.apache.eventmesh.api.admin.AbstractAdmin;
+import org.apache.eventmesh.api.admin.TopicProperties;
-import lombok.extern.slf4j.Slf4j;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
-@Slf4j
-public class PravegaStorageResourceServiceImpl implements
StorageResourceService {
+import io.cloudevents.CloudEvent;
+
+public class PravegaAdmin extends AbstractAdmin {
+
+ public PravegaAdmin() {
+ super(new AtomicBoolean(false));
+ }
+
+ @Override
+ public List<TopicProperties> getTopic() {
+ // TODO implement admin functions
+ return new ArrayList<>();
+ }
+
+ @Override
+ public void createTopic(String topicName) {
+ }
+
+ @Override
+ public void deleteTopic(String topicName) {
+ }
@Override
- public void init() throws Exception {
- PravegaClient.getInstance().start();
+ public void publish(CloudEvent cloudEvent) throws Exception {
}
@Override
- public void release() throws Exception {
- PravegaClient.getInstance().shutdown();
+ public void shutdown() {
}
}
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/admin/PravegaAdminAdaptor.java
b/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/admin/PravegaAdminAdaptor.java
new file mode 100644
index 000000000..faa53539f
--- /dev/null
+++
b/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/admin/PravegaAdminAdaptor.java
@@ -0,0 +1,85 @@
+/*
+ * 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.eventmesh.storage.pravega.admin;
+
+import org.apache.eventmesh.api.admin.Admin;
+import org.apache.eventmesh.api.admin.TopicProperties;
+
+import java.util.List;
+import java.util.Properties;
+
+import io.cloudevents.CloudEvent;
+
+public class PravegaAdminAdaptor implements Admin {
+
+ private final PravegaAdmin admin;
+
+ public PravegaAdminAdaptor() {
+ admin = new PravegaAdmin();
+ }
+
+ @Override
+ public boolean isStarted() {
+ return admin.isStarted();
+ }
+
+ @Override
+ public boolean isClosed() {
+ return admin.isClosed();
+ }
+
+ @Override
+ public void start() {
+ admin.start();
+ }
+
+ @Override
+ public void shutdown() {
+ admin.shutdown();
+ }
+
+ @Override
+ public void init(Properties properties) throws Exception {
+ admin.init(properties);
+ }
+
+ @Override
+ public List<TopicProperties> getTopic() throws Exception {
+ return admin.getTopic();
+ }
+
+ @Override
+ public void createTopic(String topicName) {
+ admin.createTopic(topicName);
+ }
+
+ @Override
+ public void deleteTopic(String topicName) {
+ admin.deleteTopic(topicName);
+ }
+
+ @Override
+ public List<CloudEvent> getEvent(String topicName, int offset, int length)
throws Exception {
+ return admin.getEvent(topicName, offset, length);
+ }
+
+ @Override
+ public void publish(CloudEvent cloudEvent) throws Exception {
+ admin.publish(cloudEvent);
+ }
+}
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/resources/META-INF/eventmesh/org.apache.eventmesh.api.admin.Admin
b/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/resources/META-INF/eventmesh/org.apache.eventmesh.api.admin.Admin
new file mode 100644
index 000000000..585a0029c
--- /dev/null
+++
b/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/resources/META-INF/eventmesh/org.apache.eventmesh.api.admin.Admin
@@ -0,0 +1,16 @@
+# 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.
+
+pravega=org.apache.eventmesh.storage.pravega.admin.PravegaAdminAdaptor
\ No newline at end of file
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaStorageResourceServiceImpl.java
b/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/admin/PulsarAdmin.java
similarity index 51%
copy from
eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaStorageResourceServiceImpl.java
copy to
eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/admin/PulsarAdmin.java
index ab8225c91..f75f655f9 100644
---
a/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/PravegaStorageResourceServiceImpl.java
+++
b/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/admin/PulsarAdmin.java
@@ -15,23 +15,42 @@
* limitations under the License.
*/
-package org.apache.eventmesh.storage.pravega;
+package org.apache.eventmesh.storage.pulsar.admin;
-import org.apache.eventmesh.api.storage.StorageResourceService;
-import org.apache.eventmesh.storage.pravega.client.PravegaClient;
+import org.apache.eventmesh.api.admin.AbstractAdmin;
+import org.apache.eventmesh.api.admin.TopicProperties;
-import lombok.extern.slf4j.Slf4j;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
-@Slf4j
-public class PravegaStorageResourceServiceImpl implements
StorageResourceService {
+import io.cloudevents.CloudEvent;
+
+public class PulsarAdmin extends AbstractAdmin {
+
+ public PulsarAdmin() {
+ super(new AtomicBoolean(false));
+ }
+
+ @Override
+ public List<TopicProperties> getTopic() {
+ // TODO implement admin functions
+ return new ArrayList<>();
+ }
+
+ @Override
+ public void createTopic(String topicName) {
+ }
+
+ @Override
+ public void deleteTopic(String topicName) {
+ }
@Override
- public void init() throws Exception {
- PravegaClient.getInstance().start();
+ public void publish(CloudEvent cloudEvent) throws Exception {
}
@Override
- public void release() throws Exception {
- PravegaClient.getInstance().shutdown();
+ public void shutdown() {
}
}
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/admin/PulsarAdminAdaptor.java
b/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/admin/PulsarAdminAdaptor.java
new file mode 100644
index 000000000..e2e58c6b7
--- /dev/null
+++
b/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/java/org/apache/eventmesh/storage/pulsar/admin/PulsarAdminAdaptor.java
@@ -0,0 +1,85 @@
+/*
+ * 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.eventmesh.storage.pulsar.admin;
+
+import org.apache.eventmesh.api.admin.Admin;
+import org.apache.eventmesh.api.admin.TopicProperties;
+
+import java.util.List;
+import java.util.Properties;
+
+import io.cloudevents.CloudEvent;
+
+public class PulsarAdminAdaptor implements Admin {
+
+ private final PulsarAdmin admin;
+
+ public PulsarAdminAdaptor() {
+ admin = new PulsarAdmin();
+ }
+
+ @Override
+ public boolean isStarted() {
+ return admin.isStarted();
+ }
+
+ @Override
+ public boolean isClosed() {
+ return admin.isClosed();
+ }
+
+ @Override
+ public void start() {
+ admin.start();
+ }
+
+ @Override
+ public void shutdown() {
+ admin.shutdown();
+ }
+
+ @Override
+ public void init(Properties properties) throws Exception {
+ admin.init(properties);
+ }
+
+ @Override
+ public List<TopicProperties> getTopic() throws Exception {
+ return admin.getTopic();
+ }
+
+ @Override
+ public void createTopic(String topicName) {
+ admin.createTopic(topicName);
+ }
+
+ @Override
+ public void deleteTopic(String topicName) {
+ admin.deleteTopic(topicName);
+ }
+
+ @Override
+ public List<CloudEvent> getEvent(String topicName, int offset, int length)
throws Exception {
+ return admin.getEvent(topicName, offset, length);
+ }
+
+ @Override
+ public void publish(CloudEvent cloudEvent) throws Exception {
+ admin.publish(cloudEvent);
+ }
+}
diff --git
a/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/resources/META-INF/eventmesh/org.apache.eventmesh.api.admin.Admin
b/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/resources/META-INF/eventmesh/org.apache.eventmesh.api.admin.Admin
new file mode 100644
index 000000000..7c43228c4
--- /dev/null
+++
b/eventmesh-storage-plugin/eventmesh-storage-pulsar/src/main/resources/META-INF/eventmesh/org.apache.eventmesh.api.admin.Admin
@@ -0,0 +1,16 @@
+# 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.
+
+pulsar=org.apache.eventmesh.storage.pulsar.admin.PulsarAdminAdaptor
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]