Skip to content

Commit 1b5998b

Browse files
committed
Initial commit: Java client for Orisun Event Store
0 parents  commit 1b5998b

21 files changed

Lines changed: 2401 additions & 0 deletions

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "protos"]
2+
path = protos
3+
url = https://github.com/oexza/orisun-proto.git

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 oexza
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Orisun Java Client
2+
3+
A Java client for the Orisun event store, providing a simple and intuitive interface for interacting with the Orisun gRPC service.
4+
5+
## Features
6+
7+
- **gRPC-based**: Built on gRPC for high-performance communication
8+
- **Type-safe**: Generated from Protocol Buffer definitions
9+
- **Easy to use**: Simple builder pattern for client configuration
10+
- **Authentication**: Support for basic authentication
11+
12+
## Installation
13+
14+
### Maven
15+
16+
```xml
17+
<dependency>
18+
<groupId>com.orisunlabs</groupId>
19+
<artifactId>orisun-java-client</artifactId>
20+
<version>0.0.1</version>
21+
</dependency>
22+
```
23+
24+
### Gradle
25+
26+
```groovy
27+
implementation 'com.orisunlabs:orisun-java-client:0.0.1'
28+
```
29+
30+
## Building from Source
31+
32+
```bash
33+
# Clone the repository
34+
git clone https://github.com/oexza/orisun-client-java.git
35+
cd orisun-client-java
36+
37+
# Initialize submodules
38+
git submodule update --init --recursive
39+
40+
# Build with Gradle
41+
./gradlew build
42+
```
43+
44+
## Proto Files
45+
46+
This client uses proto definitions from a submodule. To update the proto files:
47+
48+
```bash
49+
# Update the submodule
50+
git submodule update --remote protos
51+
52+
# Rebuild the project
53+
./gradlew build
54+
```
55+
56+
## Quick Start
57+
58+
```java
59+
import com.orisunlabs.orisun.client.OrisunClient;
60+
61+
// Create a client
62+
OrisunClient client = OrisunClient.newBuilder()
63+
.withServer("localhost", 5005)
64+
.withBasicAuth("admin", "changeit")
65+
.build();
66+
67+
// Use the client...
68+
```
69+
70+
## License
71+
72+
MIT License - see [LICENSE](LICENSE) for details.
73+
74+
## Repository
75+
76+
https://github.com/oexza/orisun-client-java

build.gradle

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
plugins {
2+
id 'java'
3+
id 'maven-publish'
4+
id 'com.google.protobuf' version '0.9.4'
5+
id 'com.github.johnrengelman.shadow' version '7.1.2'
6+
}
7+
8+
group = 'com.orisunlabs'
9+
version = '0.0.1'
10+
11+
repositories {
12+
mavenCentral()
13+
}
14+
15+
def grpcVersion = '1.75.0'
16+
def protobufVersion = '4.28.2'
17+
18+
dependencies {
19+
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
20+
implementation "io.grpc:grpc-stub:${grpcVersion}"
21+
implementation "io.grpc:grpc-netty-shaded:${grpcVersion}"
22+
implementation "com.google.protobuf:protobuf-java:${protobufVersion}"
23+
implementation 'javax.annotation:javax.annotation-api:1.3.2'
24+
25+
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1'
26+
testImplementation "io.grpc:grpc-testing:${grpcVersion}"
27+
testImplementation "io.grpc:grpc-inprocess:${grpcVersion}"
28+
}
29+
30+
shadowJar {
31+
archiveBaseName.set('orisun-client')
32+
archiveClassifier.set('')
33+
// archiveVersion.set('0.0.1') // Set your version
34+
manifest {
35+
attributes 'Main-Class': 'com.orisunlabs.orisun.client.OrisunClient' // Replace with your main class if needed
36+
}
37+
mergeServiceFiles()
38+
}
39+
40+
protobuf {
41+
protoc {
42+
artifact = "com.google.protobuf:protoc:${protobufVersion}"
43+
}
44+
45+
plugins {
46+
grpc {
47+
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
48+
}
49+
}
50+
generateProtoTasks {
51+
all()*.plugins {
52+
grpc {}
53+
}
54+
}
55+
}
56+
57+
// Configure the protobuf source directory
58+
sourceSets {
59+
main {
60+
proto {
61+
srcDir 'protos'
62+
}
63+
}
64+
}
65+
66+
java {
67+
withSourcesJar()
68+
withJavadocJar()
69+
}
70+
71+
publishing {
72+
publications {
73+
shadow(MavenPublication) { publication ->
74+
project.shadow.component(publication)
75+
groupId = 'com.orisunlabs'
76+
artifactId = 'orisun-java-client'
77+
version = version
78+
79+
pom {
80+
name = 'Orisun Java Client'
81+
description = 'Java client for the Orisun Event Store'
82+
url = 'https://github.com/oexza/orisun-client-java'
83+
licenses {
84+
license {
85+
name = 'MIT License'
86+
url = 'https://opensource.org/licenses/MIT'
87+
}
88+
}
89+
developers {
90+
developer {
91+
id = 'oexza'
92+
name = 'Your Name'
93+
email = 'your.email@example.com'
94+
}
95+
}
96+
}
97+
}
98+
}
99+
100+
repositories {
101+
maven {
102+
name = "GitHubPackages"
103+
url = uri("https://maven.pkg.github.com/oexza/orisun-client-java")
104+
credentials {
105+
username = System.getenv("GITHUB_ACTOR")
106+
password = System.getenv("GITHUB_TOKEN")
107+
}
108+
}
109+
110+
// If you want to publish to Maven Central
111+
// maven {
112+
// name = "OSSRH"
113+
// url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
114+
// credentials {
115+
// username = System.getenv("OSSRH_USERNAME")
116+
// password = System.getenv("OSSRH_PASSWORD")
117+
// }
118+
// }
119+
}
120+
}
121+
122+
test {
123+
useJUnitPlatform()
124+
}

gradle/wrapper/gradle-wrapper.jar

60.1 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)