This is an automated email from the ASF dual-hosted git repository.

tmaret pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-journal.git


The following commit(s) were added to refs/heads/master by this push:
     new f431727  SLING-8360 - Move Journal messaging API to messages bundle
f431727 is described below

commit f43172716de0def3262729fd0273383d5ccf62fa
Author: tmaret <[email protected]>
AuthorDate: Thu Apr 18 16:48:01 2019 +0200

    SLING-8360 - Move Journal messaging API to messages bundle
---
 bnd.bnd                                            |  3 +
 pom.xml                                            |  6 --
 .../sling/distribution/journal/FullMessage.java    | 41 --------------
 .../sling/distribution/journal/HandlerAdapter.java | 64 ----------------------
 .../distribution/journal/JournalAvailable.java     | 26 ---------
 .../distribution/journal/JsonMessageSender.java    | 25 ---------
 .../sling/distribution/journal/MessageHandler.java | 23 --------
 .../sling/distribution/journal/MessageInfo.java    | 30 ----------
 .../sling/distribution/journal/MessageSender.java  | 27 ---------
 .../distribution/journal/MessagingException.java   | 33 -----------
 .../distribution/journal/MessagingProvider.java    | 45 ---------------
 .../apache/sling/distribution/journal/Reset.java   | 21 -------
 .../sling/distribution/journal/RunnableUtil.java   | 37 -------------
 .../sling/distribution/journal/package-info.java   | 21 -------
 14 files changed, 3 insertions(+), 399 deletions(-)

diff --git a/bnd.bnd b/bnd.bnd
index e69de29..b009163 100644
--- a/bnd.bnd
+++ b/bnd.bnd
@@ -0,0 +1,3 @@
+Bundle-Category: sling
+Bundle-Description: ${project.description}
+Bundle-License: Apache License, Version 2.0
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 48d984d..449048f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -140,12 +140,6 @@
         <!-- OSGi -->
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.annotation</artifactId>
-            <version>7.0.0</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
             <artifactId>org.osgi.service.component.annotations</artifactId>
             <scope>provided</scope>
         </dependency>
diff --git 
a/src/main/java/org/apache/sling/distribution/journal/FullMessage.java 
b/src/main/java/org/apache/sling/distribution/journal/FullMessage.java
deleted file mode 100644
index 444c209..0000000
--- a/src/main/java/org/apache/sling/distribution/journal/FullMessage.java
+++ /dev/null
@@ -1,41 +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.
- */
-package org.apache.sling.distribution.journal;
-
-import com.google.protobuf.GeneratedMessage;
-
-public class FullMessage<T extends GeneratedMessage> {
-
-    private MessageInfo info;
-    private T message;
-
-    public FullMessage(MessageInfo info, T message) {
-        this.info = info;
-        this.message = message;
-    }
-    
-    public MessageInfo getInfo() {
-        return info;
-    }
-    
-    public T getMessage() {
-        return message;
-    }
-
-}
diff --git 
a/src/main/java/org/apache/sling/distribution/journal/HandlerAdapter.java 
b/src/main/java/org/apache/sling/distribution/journal/HandlerAdapter.java
deleted file mode 100644
index 1b59c78..0000000
--- a/src/main/java/org/apache/sling/distribution/journal/HandlerAdapter.java
+++ /dev/null
@@ -1,64 +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.
- */
-package org.apache.sling.distribution.journal;
-
-import java.lang.reflect.Method;
-
-import com.google.protobuf.ByteString;
-import com.google.protobuf.ExtensionRegistryLite;
-
-public class HandlerAdapter<T> {
-    private final MessageHandler<T> handler;
-    private final Method method;
-    private final ExtensionRegistryLite registry;
-    private final Class<T> type;
-    
-    public HandlerAdapter(Class<T> type, MessageHandler<T> handler) {
-        this.type = type;
-        this.handler = handler;
-        try {
-            method = type.getMethod("parseFrom", ByteString.class, 
ExtensionRegistryLite.class);
-        } catch (Exception e) {
-            throw new IllegalArgumentException(e);
-        }
-        registry = ExtensionRegistryLite.newInstance();
-    }
-
-    public static <T> HandlerAdapter<T> create(Class<T> type, 
MessageHandler<T> handler) {
-        return new HandlerAdapter<>(type, handler);
-    }
-    
-    @SuppressWarnings("unchecked")
-    private T parseFrom(ByteString payloadBytes) throws Exception {
-        return (T) method.invoke(null, payloadBytes, registry);
-    }
-    
-    public void handle(MessageInfo info, ByteString payloadBytes) throws 
Exception {
-        T payload = parseFrom(payloadBytes);
-        handler.handle(info, payload);
-    }
-
-    public Class<?> getType() {
-        return type;
-    }
-
-    public MessageHandler<T> getHandler() {
-        return this.handler;
-    }
-}
diff --git 
a/src/main/java/org/apache/sling/distribution/journal/JournalAvailable.java 
b/src/main/java/org/apache/sling/distribution/journal/JournalAvailable.java
deleted file mode 100644
index 5c06954..0000000
--- a/src/main/java/org/apache/sling/distribution/journal/JournalAvailable.java
+++ /dev/null
@@ -1,26 +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.
- */
-package org.apache.sling.distribution.journal;
-
-/**
- * Marker service to signal that the Journal service is available and 
correctly configured
- */
-public interface JournalAvailable {
-
-}
diff --git 
a/src/main/java/org/apache/sling/distribution/journal/JsonMessageSender.java 
b/src/main/java/org/apache/sling/distribution/journal/JsonMessageSender.java
deleted file mode 100644
index 82a4813..0000000
--- a/src/main/java/org/apache/sling/distribution/journal/JsonMessageSender.java
+++ /dev/null
@@ -1,25 +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.
- */
-package org.apache.sling.distribution.journal;
-
-public interface JsonMessageSender<T> {
-
-       void send(String topic, T payload);
-
-}
\ No newline at end of file
diff --git 
a/src/main/java/org/apache/sling/distribution/journal/MessageHandler.java 
b/src/main/java/org/apache/sling/distribution/journal/MessageHandler.java
deleted file mode 100644
index 517a8fb..0000000
--- a/src/main/java/org/apache/sling/distribution/journal/MessageHandler.java
+++ /dev/null
@@ -1,23 +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.
- */
-package org.apache.sling.distribution.journal;
-
-public interface MessageHandler<T> {
-    void handle(MessageInfo info, T message);
-}
diff --git 
a/src/main/java/org/apache/sling/distribution/journal/MessageInfo.java 
b/src/main/java/org/apache/sling/distribution/journal/MessageInfo.java
deleted file mode 100644
index 702682d..0000000
--- a/src/main/java/org/apache/sling/distribution/journal/MessageInfo.java
+++ /dev/null
@@ -1,30 +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.
- */
-package org.apache.sling.distribution.journal;
-
-public interface MessageInfo {
-
-    String getTopic();
-
-    int getPartition();
-
-    long getOffset();
-
-    long getCreateTime();
-}
diff --git 
a/src/main/java/org/apache/sling/distribution/journal/MessageSender.java 
b/src/main/java/org/apache/sling/distribution/journal/MessageSender.java
deleted file mode 100644
index 83a9eaa..0000000
--- a/src/main/java/org/apache/sling/distribution/journal/MessageSender.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
- *
- *   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.sling.distribution.journal;
-
-import com.google.protobuf.GeneratedMessage;
-
-public interface MessageSender<T extends GeneratedMessage> {
-
-       void send(String topic, T payload) throws MessagingException;
-
-}
\ No newline at end of file
diff --git 
a/src/main/java/org/apache/sling/distribution/journal/MessagingException.java 
b/src/main/java/org/apache/sling/distribution/journal/MessagingException.java
deleted file mode 100644
index 7a4855d..0000000
--- 
a/src/main/java/org/apache/sling/distribution/journal/MessagingException.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
- *
- *   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.sling.distribution.journal;
-
-public class MessagingException extends RuntimeException {
-
-    private static final long serialVersionUID = 2381842058778043644L;
-
-    public MessagingException(String message) {
-        super(message);
-    }
-    
-    public MessagingException(String message, Exception cause) {
-        super(message, cause);
-    }
-
-}
diff --git 
a/src/main/java/org/apache/sling/distribution/journal/MessagingProvider.java 
b/src/main/java/org/apache/sling/distribution/journal/MessagingProvider.java
deleted file mode 100644
index a5c6384..0000000
--- a/src/main/java/org/apache/sling/distribution/journal/MessagingProvider.java
+++ /dev/null
@@ -1,45 +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.
- */
-package org.apache.sling.distribution.journal;
-
-import java.io.Closeable;
-
-import com.google.protobuf.GeneratedMessage;
-
-public interface MessagingProvider {
-
-       <T extends GeneratedMessage> MessageSender<T> createSender();
-
-       <T> Closeable createPoller(String topicName, Reset reset, 
HandlerAdapter<?>... adapters);
-
-       Closeable createPoller(String topicName, Reset reset, String assign,
-                       HandlerAdapter<?>... adapters);
-
-       <T> JsonMessageSender<T> createJsonSender();
-
-       <T> Closeable createJsonPoller(String topicName, Reset reset, 
MessageHandler<T> handler,
-                       Class<T> type);
-
-       void assertTopic(String topic) throws MessagingException;
-
-       long retrieveOffset(String topicName, Reset reset);
-
-       String assignTo(long offset);
-
-}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/distribution/journal/Reset.java 
b/src/main/java/org/apache/sling/distribution/journal/Reset.java
deleted file mode 100644
index 283a7d4..0000000
--- a/src/main/java/org/apache/sling/distribution/journal/Reset.java
+++ /dev/null
@@ -1,21 +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.
- */
-package org.apache.sling.distribution.journal;
-
-public enum Reset { earliest, latest }
\ No newline at end of file
diff --git 
a/src/main/java/org/apache/sling/distribution/journal/RunnableUtil.java 
b/src/main/java/org/apache/sling/distribution/journal/RunnableUtil.java
deleted file mode 100644
index 10b04ec..0000000
--- a/src/main/java/org/apache/sling/distribution/journal/RunnableUtil.java
+++ /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.
- */
-package org.apache.sling.distribution.journal;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@ParametersAreNonnullByDefault
-public class RunnableUtil {
-
-    private static final Logger LOG = 
LoggerFactory.getLogger(RunnableUtil.class);
-
-    public static Thread startBackgroundThread(Runnable runnable, String 
threadName) {
-        Thread thread = new Thread(runnable, threadName);
-        thread.setDaemon(true);
-        thread.start();
-        return thread;
-    }
-}
diff --git 
a/src/main/java/org/apache/sling/distribution/journal/package-info.java 
b/src/main/java/org/apache/sling/distribution/journal/package-info.java
deleted file mode 100644
index 82ea548..0000000
--- a/src/main/java/org/apache/sling/distribution/journal/package-info.java
+++ /dev/null
@@ -1,21 +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.
- */
[email protected]("0.0.1")
-package org.apache.sling.distribution.journal;
-

Reply via email to