From cbafd743e7f5174fece172e7c0abbc5e7c856101 Mon Sep 17 00:00:00 2001 From: Matthew Smeets Date: Mon, 22 Apr 2024 14:07:19 +0200 Subject: [PATCH 1/3] update versioning --- .gitignore | 1 + LICENSE | 1 + README.md | 16 ++++----- build.gradle | 21 ++++++----- pom.xml | 28 ++++++++++----- .../mercure/Message.java | 14 ++++---- .../mercure/Publisher.java | 20 +++++------ .../mattsmeets/mercure/auth/JWTFactory.java | 30 ++++++++++++++++ .../mattsmeets/mercure/auth/MercureClaim.java | 35 +++++++++++++++++++ .../exceptions/HubNotFoundException.java | 2 +- .../exceptions/PublishRejectedException.java | 2 +- .../UnauthorizedPublisherException.java | 2 +- .../mercure/http/Client.java | 17 ++++----- .../http/exceptions/ForbiddenException.java | 2 +- .../http/exceptions/NotFoundException.java | 2 +- .../exceptions/UnauthorizedException.java | 2 +- 16 files changed, 138 insertions(+), 57 deletions(-) rename src/main/java/com/{vitorvillar => mattsmeets}/mercure/Message.java (79%) rename src/main/java/com/{vitorvillar => mattsmeets}/mercure/Publisher.java (66%) create mode 100644 src/main/java/com/mattsmeets/mercure/auth/JWTFactory.java create mode 100644 src/main/java/com/mattsmeets/mercure/auth/MercureClaim.java rename src/main/java/com/{vitorvillar => mattsmeets}/mercure/exceptions/HubNotFoundException.java (56%) rename src/main/java/com/{vitorvillar => mattsmeets}/mercure/exceptions/PublishRejectedException.java (76%) rename src/main/java/com/{vitorvillar => mattsmeets}/mercure/exceptions/UnauthorizedPublisherException.java (78%) rename src/main/java/com/{vitorvillar => mattsmeets}/mercure/http/Client.java (80%) rename src/main/java/com/{vitorvillar => mattsmeets}/mercure/http/exceptions/ForbiddenException.java (73%) rename src/main/java/com/{vitorvillar => mattsmeets}/mercure/http/exceptions/NotFoundException.java (52%) rename src/main/java/com/{vitorvillar => mattsmeets}/mercure/http/exceptions/UnauthorizedException.java (73%) diff --git a/.gitignore b/.gitignore index 97064d8..dc3ae0b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ HELP.md .gradle build/ +target/ !gradle/wrapper/gradle-wrapper.jar !**/src/main/** !**/src/test/** diff --git a/LICENSE b/LICENSE index dad59f4..0b96e91 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ MIT License Copyright (c) 2019 Vitor Villar +Copyright (c) 2024 Matthew Smeets Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 50c4490..fba821b 100644 --- a/README.md +++ b/README.md @@ -7,17 +7,17 @@ If you don't know what Mercure is, take a look here: (https://github.com/dunglas You can install via Gradle or Maven. Whatever floats your boat. :) -Gradle: +Gradle #TODO: ```groovy -implementation 'com.vitorvillar:mercure:1.0.0' +implementation 'com.mattsmeets:mercure:1.0.0' ``` Maven: ```xml - com.vitorvillar + com.mattsmeets mercure - 1.0.0 + 0.14.4-0 pom ``` @@ -30,11 +30,11 @@ want to publish, just create a new `Message` object. Here is an example: ```java -package com.vitorvillar.test; +package com.mattsmeets.test; -import com.vitorvillar.mercure.exceptions.HubNotFoundException; -import com.vitorvillar.mercure.exceptions.PublishRejectedException; -import com.vitorvillar.mercure.exceptions.UnauthorizedPublisherException; +import exceptions.com.mattsmeets.mercure.HubNotFoundException; +import exceptions.com.mattsmeets.mercure.PublishRejectedException; +import exceptions.com.mattsmeets.mercure.UnauthorizedPublisherException; public class Main { diff --git a/build.gradle b/build.gradle index 7799b0b..72272f6 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'maven-publish' apply plugin: 'signing' apply plugin: 'java-library' -group 'com.vitorvillar' +group 'com.mattsmeets' version '1.0-RELEASE' sourceCompatibility = 1.11 @@ -61,7 +61,7 @@ publishing { publications { mavenJava(MavenPublication) { customizePom(pom) - groupId 'com.vitorvillar' + groupId 'com.mattsmeets' artifactId 'mercure' version '1.0.0' @@ -127,29 +127,32 @@ def customizePom(pom) { name 'Java Mercure' url 'https://github.com/vitorluis/java-mercure' organization { - name 'com.vitorvillar' - url 'https://vitorvillar.com' + name 'com.mattsmeets' + url 'https://github.com/matts' } issueManagement { system 'GitHub' - url 'https://github.com/vitorluis/java-mercure/issues' + url 'https://github.com/matts/java-mercure/issues' } licenses { license { name 'MIT License' - url 'https://github.com/vitorluis/java-mercure/blob/master/LICENSE' + url 'https://github.com/matts/java-mercure/blob/master/LICENSE' distribution 'repo' } } scm { - url 'https://github.com/vitorluis/java-mercure' - connection 'scm:git:git@github.com:vitorluis/java-mercure.git' - developerConnection 'scm:git:https://github.com/vitorluis/java-mercure.git' + url 'https://github.com/matts/java-mercure/java-mercure' + connection 'scm:git:git@github.com:matts/java-mercure.git' + developerConnection 'scm:git:https://github.com/matts/java-mercure.git' } developers { developer { name 'Vitor Villar' } + developer { + name 'Matt Smeets' + } } } } diff --git a/pom.xml b/pom.xml index 0558f0e..1980409 100644 --- a/pom.xml +++ b/pom.xml @@ -2,14 +2,19 @@ 4.0.0 - com.vitorvillar + com.mattsmeets mercure - 1.0.0 + 0.14.4-0 jar - Java Mercure - Java Plugin to Publish messages on Mercure Hub - https://github.com/vitorluis/java-mercure + Java Mercure SDK + Java Mercure SDK + http://github.com/matts/java-mercure + + Matthew Smeets + matthew@reuzenpanda.nl + http://github.com/matts + Vitor Villar vitor.luis98@gmail.com @@ -24,9 +29,9 @@ - https://github.com/vitorluis/java-mercure - scm:git:git@github.com:vitorluis/java-mercure.git - scm:git:https://github.com/vitorluis/java-mercure.git + https://github.com/matts/java-mercure + scm:git:git@github.com:matts/java-mercure.git + scm:git:https://github.com/matts/java-mercure.git 1.11 @@ -95,7 +100,12 @@ org.apache.httpcomponents httpclient - 4.5.10 + 4.5.14 + + + io.jsonwebtoken + jjwt + 0.12.5 \ No newline at end of file diff --git a/src/main/java/com/vitorvillar/mercure/Message.java b/src/main/java/com/mattsmeets/mercure/Message.java similarity index 79% rename from src/main/java/com/vitorvillar/mercure/Message.java rename to src/main/java/com/mattsmeets/mercure/Message.java index 70c5d70..4f308f1 100644 --- a/src/main/java/com/vitorvillar/mercure/Message.java +++ b/src/main/java/com/mattsmeets/mercure/Message.java @@ -1,4 +1,4 @@ -package com.vitorvillar.mercure; +package com.mattsmeets.mercure; import java.util.UUID; @@ -7,7 +7,7 @@ public class Message { private UUID id; private String data; private String topic; - private Boolean private; + private Boolean privateMessage; private String type; public Message(String data, String topic) { @@ -16,11 +16,11 @@ public Message(String data, String topic) { this.id = UUID.randomUUID(); } - public Message(UUID id, String data, String topic, Boolean private, String type) { + public Message(UUID id, String data, String topic, Boolean privateMessage, String type) { this.id = id; this.data = data; this.topic = topic; - this.private = private; + this.privateMessage = privateMessage; this.type = type; } @@ -49,11 +49,11 @@ public void setId(UUID id) { } public Boolean isPrivate() { - return private; + return privateMessage; } - public void setPrivate(Boolean private) { - this.private = private; + public void setPrivate(Boolean isPrivate) { + this.privateMessage = isPrivate; } public String getType() { diff --git a/src/main/java/com/vitorvillar/mercure/Publisher.java b/src/main/java/com/mattsmeets/mercure/Publisher.java similarity index 66% rename from src/main/java/com/vitorvillar/mercure/Publisher.java rename to src/main/java/com/mattsmeets/mercure/Publisher.java index 95bdd2c..6e17f30 100644 --- a/src/main/java/com/vitorvillar/mercure/Publisher.java +++ b/src/main/java/com/mattsmeets/mercure/Publisher.java @@ -1,12 +1,12 @@ -package com.vitorvillar.mercure; +package com.mattsmeets.mercure; -import com.vitorvillar.mercure.exceptions.HubNotFoundException; -import com.vitorvillar.mercure.exceptions.PublishRejectedException; -import com.vitorvillar.mercure.exceptions.UnauthorizedPublisherException; -import com.vitorvillar.mercure.http.Client; -import com.vitorvillar.mercure.http.exceptions.ForbiddenException; -import com.vitorvillar.mercure.http.exceptions.NotFoundException; -import com.vitorvillar.mercure.http.exceptions.UnauthorizedException; +import com.mattsmeets.mercure.exceptions.HubNotFoundException; +import com.mattsmeets.mercure.exceptions.PublishRejectedException; +import com.mattsmeets.mercure.exceptions.UnauthorizedPublisherException; +import com.mattsmeets.mercure.http.Client; +import com.mattsmeets.mercure.http.exceptions.ForbiddenException; +import com.mattsmeets.mercure.http.exceptions.NotFoundException; +import com.mattsmeets.mercure.http.exceptions.UnauthorizedException; import java.util.HashMap; import java.util.UUID; @@ -21,7 +21,7 @@ public Publisher(String mercureHub, String mercureToken) { public Message publish(Message message) throws UnauthorizedPublisherException, PublishRejectedException, HubNotFoundException { - var parameters = new HashMap(); + HashMap parameters = new HashMap(); parameters.put("data", message.getData()); parameters.put("topic", message.getTopic()); parameters.put("id", message.getId().toString()); @@ -35,7 +35,7 @@ public Message publish(Message message) throws UnauthorizedPublisherException, P } try { - var messageId = this.httpClient.sendRequest(parameters); + String messageId = this.httpClient.sendRequest(parameters); message.setId(UUID.fromString(messageId)); return message; diff --git a/src/main/java/com/mattsmeets/mercure/auth/JWTFactory.java b/src/main/java/com/mattsmeets/mercure/auth/JWTFactory.java new file mode 100644 index 0000000..52de8f6 --- /dev/null +++ b/src/main/java/com/mattsmeets/mercure/auth/JWTFactory.java @@ -0,0 +1,30 @@ +package com.mattsmeets.mercure.auth; + +import io.jsonwebtoken.JwtBuilder; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; + +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class JWTFactory { + + public static JwtBuilder createBuilder(MercureClaim mercureClaim, long expiration, String secret) { + Map jwtClaims = new HashMap<>(); + jwtClaims.put("mercure", mercureClaim); + + return Jwts.builder() + .setClaims(jwtClaims) + .setIssuedAt(new Date(System.currentTimeMillis())) + .setExpiration(new Date(expiration)) + .signWith(SignatureAlgorithm.HS256, secret.getBytes()) + .setHeaderParam("typ", "JWT"); + } + + public static String createToken(MercureClaim mercureClaim, long expiration, String secret) { + return createBuilder(mercureClaim, expiration, secret).compact(); + } + +} diff --git a/src/main/java/com/mattsmeets/mercure/auth/MercureClaim.java b/src/main/java/com/mattsmeets/mercure/auth/MercureClaim.java new file mode 100644 index 0000000..c7a8729 --- /dev/null +++ b/src/main/java/com/mattsmeets/mercure/auth/MercureClaim.java @@ -0,0 +1,35 @@ +package com.mattsmeets.mercure.auth; + +import java.util.ArrayList; +import java.util.List; + +public class MercureClaim { + private List subscribe; + private List publish; + + public MercureClaim(List subscribe, List publish) { + this.subscribe = subscribe; + this.publish = publish; + } + + public MercureClaim(List subscribe) { + this.subscribe = subscribe; + this.publish = new ArrayList<>(); + } + + public List getSubscribe() { + return subscribe; + } + + public void setSubscribe(List subscribe) { + this.subscribe = subscribe; + } + + public List getPublish() { + return publish; + } + + public void setPublish(List publish) { + this.publish = publish; + } +} diff --git a/src/main/java/com/vitorvillar/mercure/exceptions/HubNotFoundException.java b/src/main/java/com/mattsmeets/mercure/exceptions/HubNotFoundException.java similarity index 56% rename from src/main/java/com/vitorvillar/mercure/exceptions/HubNotFoundException.java rename to src/main/java/com/mattsmeets/mercure/exceptions/HubNotFoundException.java index 73d25a9..b4ca5da 100644 --- a/src/main/java/com/vitorvillar/mercure/exceptions/HubNotFoundException.java +++ b/src/main/java/com/mattsmeets/mercure/exceptions/HubNotFoundException.java @@ -1,4 +1,4 @@ -package com.vitorvillar.mercure.exceptions; +package com.mattsmeets.mercure.exceptions; public class HubNotFoundException extends Exception { } diff --git a/src/main/java/com/vitorvillar/mercure/exceptions/PublishRejectedException.java b/src/main/java/com/mattsmeets/mercure/exceptions/PublishRejectedException.java similarity index 76% rename from src/main/java/com/vitorvillar/mercure/exceptions/PublishRejectedException.java rename to src/main/java/com/mattsmeets/mercure/exceptions/PublishRejectedException.java index e4733f9..e6c8b77 100644 --- a/src/main/java/com/vitorvillar/mercure/exceptions/PublishRejectedException.java +++ b/src/main/java/com/mattsmeets/mercure/exceptions/PublishRejectedException.java @@ -1,4 +1,4 @@ -package com.vitorvillar.mercure.exceptions; +package com.mattsmeets.mercure.exceptions; public class PublishRejectedException extends Exception { public PublishRejectedException(String message) { diff --git a/src/main/java/com/vitorvillar/mercure/exceptions/UnauthorizedPublisherException.java b/src/main/java/com/mattsmeets/mercure/exceptions/UnauthorizedPublisherException.java similarity index 78% rename from src/main/java/com/vitorvillar/mercure/exceptions/UnauthorizedPublisherException.java rename to src/main/java/com/mattsmeets/mercure/exceptions/UnauthorizedPublisherException.java index 12abaf5..20f0be6 100644 --- a/src/main/java/com/vitorvillar/mercure/exceptions/UnauthorizedPublisherException.java +++ b/src/main/java/com/mattsmeets/mercure/exceptions/UnauthorizedPublisherException.java @@ -1,4 +1,4 @@ -package com.vitorvillar.mercure.exceptions; +package com.mattsmeets.mercure.exceptions; public class UnauthorizedPublisherException extends Exception { public UnauthorizedPublisherException(String message) { diff --git a/src/main/java/com/vitorvillar/mercure/http/Client.java b/src/main/java/com/mattsmeets/mercure/http/Client.java similarity index 80% rename from src/main/java/com/vitorvillar/mercure/http/Client.java rename to src/main/java/com/mattsmeets/mercure/http/Client.java index 9ecb5d6..5fcf27a 100644 --- a/src/main/java/com/vitorvillar/mercure/http/Client.java +++ b/src/main/java/com/mattsmeets/mercure/http/Client.java @@ -1,9 +1,10 @@ -package com.vitorvillar.mercure.http; +package com.mattsmeets.mercure.http; -import com.vitorvillar.mercure.http.exceptions.ForbiddenException; -import com.vitorvillar.mercure.http.exceptions.NotFoundException; -import com.vitorvillar.mercure.http.exceptions.UnauthorizedException; +import com.mattsmeets.mercure.http.exceptions.ForbiddenException; +import com.mattsmeets.mercure.http.exceptions.NotFoundException; +import com.mattsmeets.mercure.http.exceptions.UnauthorizedException; +import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; @@ -32,21 +33,21 @@ public Client(String url, String authorizationToken) { public String sendRequest(Map postData) throws UnauthorizedException, ForbiddenException, NotFoundException { - var responseContent = ""; - var request = new HttpPost(this.url); + String responseContent = ""; + HttpPost request = new HttpPost(this.url); request.addHeader("Authorization", "Bearer " + this.authorizationToken); request.addHeader("Content-Type", "application/x-www-form-urlencoded"); List parameters = new ArrayList<>(); - for (var entry : postData.entrySet()) { + for (Map.Entry entry : postData.entrySet()) { parameters.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); } try { request.setEntity(new UrlEncodedFormEntity(parameters, "UTF-8")); - var response = this.httpClient.execute(request); + HttpResponse response = this.httpClient.execute(request); if (response.getEntity() != null) { responseContent = EntityUtils.toString(response.getEntity()); } diff --git a/src/main/java/com/vitorvillar/mercure/http/exceptions/ForbiddenException.java b/src/main/java/com/mattsmeets/mercure/http/exceptions/ForbiddenException.java similarity index 73% rename from src/main/java/com/vitorvillar/mercure/http/exceptions/ForbiddenException.java rename to src/main/java/com/mattsmeets/mercure/http/exceptions/ForbiddenException.java index 847eca4..b38467b 100644 --- a/src/main/java/com/vitorvillar/mercure/http/exceptions/ForbiddenException.java +++ b/src/main/java/com/mattsmeets/mercure/http/exceptions/ForbiddenException.java @@ -1,4 +1,4 @@ -package com.vitorvillar.mercure.http.exceptions; +package com.mattsmeets.mercure.http.exceptions; public class ForbiddenException extends Exception { public ForbiddenException(String message) { diff --git a/src/main/java/com/vitorvillar/mercure/http/exceptions/NotFoundException.java b/src/main/java/com/mattsmeets/mercure/http/exceptions/NotFoundException.java similarity index 52% rename from src/main/java/com/vitorvillar/mercure/http/exceptions/NotFoundException.java rename to src/main/java/com/mattsmeets/mercure/http/exceptions/NotFoundException.java index 0710ef5..8154f9f 100644 --- a/src/main/java/com/vitorvillar/mercure/http/exceptions/NotFoundException.java +++ b/src/main/java/com/mattsmeets/mercure/http/exceptions/NotFoundException.java @@ -1,4 +1,4 @@ -package com.vitorvillar.mercure.http.exceptions; +package com.mattsmeets.mercure.http.exceptions; public class NotFoundException extends Exception { } diff --git a/src/main/java/com/vitorvillar/mercure/http/exceptions/UnauthorizedException.java b/src/main/java/com/mattsmeets/mercure/http/exceptions/UnauthorizedException.java similarity index 73% rename from src/main/java/com/vitorvillar/mercure/http/exceptions/UnauthorizedException.java rename to src/main/java/com/mattsmeets/mercure/http/exceptions/UnauthorizedException.java index 3558fda..1b0cb2b 100644 --- a/src/main/java/com/vitorvillar/mercure/http/exceptions/UnauthorizedException.java +++ b/src/main/java/com/mattsmeets/mercure/http/exceptions/UnauthorizedException.java @@ -1,4 +1,4 @@ -package com.vitorvillar.mercure.http.exceptions; +package com.mattsmeets.mercure.http.exceptions; public class UnauthorizedException extends Exception { public UnauthorizedException(String message) { From 3ebb51edff6b2226d1f45665b95f95f041212dda Mon Sep 17 00:00:00 2001 From: Matthew Smeets Date: Tue, 23 Apr 2024 09:12:16 +0200 Subject: [PATCH 2/3] rename to github namespaces --- README.md | 12 ++++++------ build.gradle | 6 +++--- pom.xml | 2 +- .../github/matts}/mercure/Message.java | 2 +- .../github/matts}/mercure/Publisher.java | 18 +++++++++--------- .../github/matts}/mercure/auth/JWTFactory.java | 3 +-- .../matts}/mercure/auth/MercureClaim.java | 2 +- .../exceptions/HubNotFoundException.java | 2 +- .../exceptions/PublishRejectedException.java | 2 +- .../UnauthorizedPublisherException.java | 2 +- .../github/matts}/mercure/http/Client.java | 8 ++++---- .../http/exceptions/ForbiddenException.java | 2 +- .../http/exceptions/NotFoundException.java | 2 +- .../http/exceptions/UnauthorizedException.java | 2 +- 14 files changed, 32 insertions(+), 33 deletions(-) rename src/main/java/{com/mattsmeets => io/github/matts}/mercure/Message.java (97%) rename src/main/java/{com/mattsmeets => io/github/matts}/mercure/Publisher.java (73%) rename src/main/java/{com/mattsmeets => io/github/matts}/mercure/auth/JWTFactory.java (93%) rename src/main/java/{com/mattsmeets => io/github/matts}/mercure/auth/MercureClaim.java (95%) rename src/main/java/{com/mattsmeets => io/github/matts}/mercure/exceptions/HubNotFoundException.java (56%) rename src/main/java/{com/mattsmeets => io/github/matts}/mercure/exceptions/PublishRejectedException.java (76%) rename src/main/java/{com/mattsmeets => io/github/matts}/mercure/exceptions/UnauthorizedPublisherException.java (78%) rename src/main/java/{com/mattsmeets => io/github/matts}/mercure/http/Client.java (90%) rename src/main/java/{com/mattsmeets => io/github/matts}/mercure/http/exceptions/ForbiddenException.java (73%) rename src/main/java/{com/mattsmeets => io/github/matts}/mercure/http/exceptions/NotFoundException.java (52%) rename src/main/java/{com/mattsmeets => io/github/matts}/mercure/http/exceptions/UnauthorizedException.java (73%) diff --git a/README.md b/README.md index fba821b..d1441c2 100644 --- a/README.md +++ b/README.md @@ -9,13 +9,13 @@ You can install via Gradle or Maven. Whatever floats your boat. :) Gradle #TODO: ```groovy -implementation 'com.mattsmeets:mercure:1.0.0' +implementation 'io.github.matts:mercure:1.0.0' ``` Maven: ```xml - com.mattsmeets + io.github.matts mercure 0.14.4-0 pom @@ -30,11 +30,11 @@ want to publish, just create a new `Message` object. Here is an example: ```java -package com.mattsmeets.test; +package io.github.matts.test; -import exceptions.com.mattsmeets.mercure.HubNotFoundException; -import exceptions.com.mattsmeets.mercure.PublishRejectedException; -import exceptions.com.mattsmeets.mercure.UnauthorizedPublisherException; +import exceptions.io.github.matts.mercure.HubNotFoundException; +import exceptions.io.github.matts.mercure.PublishRejectedException; +import exceptions.io.github.matts.mercure.UnauthorizedPublisherException; public class Main { diff --git a/build.gradle b/build.gradle index 72272f6..ca2ba7c 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'maven-publish' apply plugin: 'signing' apply plugin: 'java-library' -group 'com.mattsmeets' +group 'io.github.matts' version '1.0-RELEASE' sourceCompatibility = 1.11 @@ -61,7 +61,7 @@ publishing { publications { mavenJava(MavenPublication) { customizePom(pom) - groupId 'com.mattsmeets' + groupId 'io.github.matts' artifactId 'mercure' version '1.0.0' @@ -127,7 +127,7 @@ def customizePom(pom) { name 'Java Mercure' url 'https://github.com/vitorluis/java-mercure' organization { - name 'com.mattsmeets' + name 'io.github.matts' url 'https://github.com/matts' } issueManagement { diff --git a/pom.xml b/pom.xml index 1980409..7d42d5c 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - com.mattsmeets + io.github.matts mercure 0.14.4-0 jar diff --git a/src/main/java/com/mattsmeets/mercure/Message.java b/src/main/java/io/github/matts/mercure/Message.java similarity index 97% rename from src/main/java/com/mattsmeets/mercure/Message.java rename to src/main/java/io/github/matts/mercure/Message.java index 4f308f1..9b6b4cc 100644 --- a/src/main/java/com/mattsmeets/mercure/Message.java +++ b/src/main/java/io/github/matts/mercure/Message.java @@ -1,4 +1,4 @@ -package com.mattsmeets.mercure; +package io.github.matts.mercure; import java.util.UUID; diff --git a/src/main/java/com/mattsmeets/mercure/Publisher.java b/src/main/java/io/github/matts/mercure/Publisher.java similarity index 73% rename from src/main/java/com/mattsmeets/mercure/Publisher.java rename to src/main/java/io/github/matts/mercure/Publisher.java index 6e17f30..0a3250c 100644 --- a/src/main/java/com/mattsmeets/mercure/Publisher.java +++ b/src/main/java/io/github/matts/mercure/Publisher.java @@ -1,12 +1,12 @@ -package com.mattsmeets.mercure; - -import com.mattsmeets.mercure.exceptions.HubNotFoundException; -import com.mattsmeets.mercure.exceptions.PublishRejectedException; -import com.mattsmeets.mercure.exceptions.UnauthorizedPublisherException; -import com.mattsmeets.mercure.http.Client; -import com.mattsmeets.mercure.http.exceptions.ForbiddenException; -import com.mattsmeets.mercure.http.exceptions.NotFoundException; -import com.mattsmeets.mercure.http.exceptions.UnauthorizedException; +package io.github.matts.mercure; + +import io.github.matts.mercure.exceptions.HubNotFoundException; +import io.github.matts.mercure.exceptions.PublishRejectedException; +import io.github.matts.mercure.exceptions.UnauthorizedPublisherException; +import io.github.matts.mercure.http.Client; +import io.github.matts.mercure.http.exceptions.ForbiddenException; +import io.github.matts.mercure.http.exceptions.NotFoundException; +import io.github.matts.mercure.http.exceptions.UnauthorizedException; import java.util.HashMap; import java.util.UUID; diff --git a/src/main/java/com/mattsmeets/mercure/auth/JWTFactory.java b/src/main/java/io/github/matts/mercure/auth/JWTFactory.java similarity index 93% rename from src/main/java/com/mattsmeets/mercure/auth/JWTFactory.java rename to src/main/java/io/github/matts/mercure/auth/JWTFactory.java index 52de8f6..a341191 100644 --- a/src/main/java/com/mattsmeets/mercure/auth/JWTFactory.java +++ b/src/main/java/io/github/matts/mercure/auth/JWTFactory.java @@ -1,4 +1,4 @@ -package com.mattsmeets.mercure.auth; +package io.github.matts.mercure.auth; import io.jsonwebtoken.JwtBuilder; import io.jsonwebtoken.Jwts; @@ -6,7 +6,6 @@ import java.util.Date; import java.util.HashMap; -import java.util.List; import java.util.Map; public class JWTFactory { diff --git a/src/main/java/com/mattsmeets/mercure/auth/MercureClaim.java b/src/main/java/io/github/matts/mercure/auth/MercureClaim.java similarity index 95% rename from src/main/java/com/mattsmeets/mercure/auth/MercureClaim.java rename to src/main/java/io/github/matts/mercure/auth/MercureClaim.java index c7a8729..a01d010 100644 --- a/src/main/java/com/mattsmeets/mercure/auth/MercureClaim.java +++ b/src/main/java/io/github/matts/mercure/auth/MercureClaim.java @@ -1,4 +1,4 @@ -package com.mattsmeets.mercure.auth; +package io.github.matts.mercure.auth; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/mattsmeets/mercure/exceptions/HubNotFoundException.java b/src/main/java/io/github/matts/mercure/exceptions/HubNotFoundException.java similarity index 56% rename from src/main/java/com/mattsmeets/mercure/exceptions/HubNotFoundException.java rename to src/main/java/io/github/matts/mercure/exceptions/HubNotFoundException.java index b4ca5da..26348fa 100644 --- a/src/main/java/com/mattsmeets/mercure/exceptions/HubNotFoundException.java +++ b/src/main/java/io/github/matts/mercure/exceptions/HubNotFoundException.java @@ -1,4 +1,4 @@ -package com.mattsmeets.mercure.exceptions; +package io.github.matts.mercure.exceptions; public class HubNotFoundException extends Exception { } diff --git a/src/main/java/com/mattsmeets/mercure/exceptions/PublishRejectedException.java b/src/main/java/io/github/matts/mercure/exceptions/PublishRejectedException.java similarity index 76% rename from src/main/java/com/mattsmeets/mercure/exceptions/PublishRejectedException.java rename to src/main/java/io/github/matts/mercure/exceptions/PublishRejectedException.java index e6c8b77..6a228d3 100644 --- a/src/main/java/com/mattsmeets/mercure/exceptions/PublishRejectedException.java +++ b/src/main/java/io/github/matts/mercure/exceptions/PublishRejectedException.java @@ -1,4 +1,4 @@ -package com.mattsmeets.mercure.exceptions; +package io.github.matts.mercure.exceptions; public class PublishRejectedException extends Exception { public PublishRejectedException(String message) { diff --git a/src/main/java/com/mattsmeets/mercure/exceptions/UnauthorizedPublisherException.java b/src/main/java/io/github/matts/mercure/exceptions/UnauthorizedPublisherException.java similarity index 78% rename from src/main/java/com/mattsmeets/mercure/exceptions/UnauthorizedPublisherException.java rename to src/main/java/io/github/matts/mercure/exceptions/UnauthorizedPublisherException.java index 20f0be6..decdfee 100644 --- a/src/main/java/com/mattsmeets/mercure/exceptions/UnauthorizedPublisherException.java +++ b/src/main/java/io/github/matts/mercure/exceptions/UnauthorizedPublisherException.java @@ -1,4 +1,4 @@ -package com.mattsmeets.mercure.exceptions; +package io.github.matts.mercure.exceptions; public class UnauthorizedPublisherException extends Exception { public UnauthorizedPublisherException(String message) { diff --git a/src/main/java/com/mattsmeets/mercure/http/Client.java b/src/main/java/io/github/matts/mercure/http/Client.java similarity index 90% rename from src/main/java/com/mattsmeets/mercure/http/Client.java rename to src/main/java/io/github/matts/mercure/http/Client.java index 5fcf27a..b406608 100644 --- a/src/main/java/com/mattsmeets/mercure/http/Client.java +++ b/src/main/java/io/github/matts/mercure/http/Client.java @@ -1,9 +1,9 @@ -package com.mattsmeets.mercure.http; +package io.github.matts.mercure.http; -import com.mattsmeets.mercure.http.exceptions.ForbiddenException; -import com.mattsmeets.mercure.http.exceptions.NotFoundException; -import com.mattsmeets.mercure.http.exceptions.UnauthorizedException; +import io.github.matts.mercure.http.exceptions.ForbiddenException; +import io.github.matts.mercure.http.exceptions.NotFoundException; +import io.github.matts.mercure.http.exceptions.UnauthorizedException; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.NameValuePair; diff --git a/src/main/java/com/mattsmeets/mercure/http/exceptions/ForbiddenException.java b/src/main/java/io/github/matts/mercure/http/exceptions/ForbiddenException.java similarity index 73% rename from src/main/java/com/mattsmeets/mercure/http/exceptions/ForbiddenException.java rename to src/main/java/io/github/matts/mercure/http/exceptions/ForbiddenException.java index b38467b..8218913 100644 --- a/src/main/java/com/mattsmeets/mercure/http/exceptions/ForbiddenException.java +++ b/src/main/java/io/github/matts/mercure/http/exceptions/ForbiddenException.java @@ -1,4 +1,4 @@ -package com.mattsmeets.mercure.http.exceptions; +package io.github.matts.mercure.http.exceptions; public class ForbiddenException extends Exception { public ForbiddenException(String message) { diff --git a/src/main/java/com/mattsmeets/mercure/http/exceptions/NotFoundException.java b/src/main/java/io/github/matts/mercure/http/exceptions/NotFoundException.java similarity index 52% rename from src/main/java/com/mattsmeets/mercure/http/exceptions/NotFoundException.java rename to src/main/java/io/github/matts/mercure/http/exceptions/NotFoundException.java index 8154f9f..964f143 100644 --- a/src/main/java/com/mattsmeets/mercure/http/exceptions/NotFoundException.java +++ b/src/main/java/io/github/matts/mercure/http/exceptions/NotFoundException.java @@ -1,4 +1,4 @@ -package com.mattsmeets.mercure.http.exceptions; +package io.github.matts.mercure.http.exceptions; public class NotFoundException extends Exception { } diff --git a/src/main/java/com/mattsmeets/mercure/http/exceptions/UnauthorizedException.java b/src/main/java/io/github/matts/mercure/http/exceptions/UnauthorizedException.java similarity index 73% rename from src/main/java/com/mattsmeets/mercure/http/exceptions/UnauthorizedException.java rename to src/main/java/io/github/matts/mercure/http/exceptions/UnauthorizedException.java index 1b0cb2b..6c6cd76 100644 --- a/src/main/java/com/mattsmeets/mercure/http/exceptions/UnauthorizedException.java +++ b/src/main/java/io/github/matts/mercure/http/exceptions/UnauthorizedException.java @@ -1,4 +1,4 @@ -package com.mattsmeets.mercure.http.exceptions; +package io.github.matts.mercure.http.exceptions; public class UnauthorizedException extends Exception { public UnauthorizedException(String message) { From 429a94aef8b1678a643cf7baa1c78694f66f4e6f Mon Sep 17 00:00:00 2001 From: Matthew Smeets Date: Tue, 23 Apr 2024 10:34:26 +0200 Subject: [PATCH 3/3] adding some description --- .DS_Store | Bin 0 -> 6148 bytes README.md | 12 ++++-- pom.xml | 126 ++++++++++++++++++++++++++++-------------------------- 3 files changed, 74 insertions(+), 64 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..26eabd7deab5a0b89409f9596186dcb1be92987a GIT binary patch literal 6148 zcmeHKOHRWu6dbpKmX=SKY>;w-O57kV?V=K}pckM&MU?_Yr4=l*=MG$f^Ra??wn2$Y zS)vNPSNTnB&)D%)iDLk!yPlo{EdX^E!KlIXLrA}rji~sRBchQp2H9dV&K6_VWk3ye zKpog^2jtm}&_;?mR>AYzVPE^hhFwJCi$`vXdn~ZTEYQ3Knwr%tF~SsC$TnvIdynin znKO*aR%d5AIAy9s!6En{Dvge)hlwp6CUK})9Z(0#4pd#WCHsGW`}w~t(waJ;4*V+zOw=3px?GaqTQ?Rbdu_~e r%OWAX+@X~)`R&+V$X0yHVuO9LTo4nFxkI)v^h3bfph+G0QwKf)$x^p; literal 0 HcmV?d00001 diff --git a/README.md b/README.md index d1441c2..b88a664 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,9 @@ If you don't know what Mercure is, take a look here: (https://github.com/dunglas You can install via Gradle or Maven. Whatever floats your boat. :) -Gradle #TODO: +Gradle: ```groovy -implementation 'io.github.matts:mercure:1.0.0' +implementation 'io.github.matts:mercure:0.14.4-1' ``` Maven: @@ -17,7 +17,7 @@ Maven: io.github.matts mercure - 0.14.4-0 + 0.14.4-1 pom ``` @@ -51,6 +51,10 @@ public class Main { ``` +## Versioning + +This project is prefixed by the version of the Mercure protocol it supports, followed by a build number. The current version is 0.14.4-1 + ## Credits -Created and maintained by Vitor Villar \ No newline at end of file +Forked from Vitor Villar https://github.com/vitorluis/java-mercure \ No newline at end of file diff --git a/pom.xml b/pom.xml index 7d42d5c..aaf7c11 100644 --- a/pom.xml +++ b/pom.xml @@ -3,8 +3,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 io.github.matts - mercure - 0.14.4-0 + java-mercure + 0.14.4-1 jar Java Mercure SDK Java Mercure SDK @@ -38,64 +38,6 @@ UTF-8 UTF-8 - - - release - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.0.1 - - - attach-sources - - jar-no-fork - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.0.0 - - - attach-javadocs - - jar - - - - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - - - - - org.apache.httpcomponents @@ -108,4 +50,68 @@ 0.12.5 + + + + + org.sonatype.central + central-publishing-maven-plugin + 0.4.0 + true + + central + true + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + + + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + attach-sources + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + 1FAC872FB4DB53BA + + --batch + --pinentry-mode + loopback + --passphrase + ${env.GPG_PASSPHRASE} + + + + + + + \ No newline at end of file