Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

Commit

Permalink
version 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
VKrus committed Apr 15, 2021
1 parent 3bf1692 commit 9a972b4
Show file tree
Hide file tree
Showing 6 changed files with 467 additions and 41 deletions.
35 changes: 4 additions & 31 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,31 +1,4 @@
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

/.gradle
/.idea
/build
/gradle
gradle.properties
gradlew
gradlew.bat
.idea
build
gradle
.gradle
44 changes: 43 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,43 @@
# Retrofit2-ZOSMF-Library
## zOSMF Retrofit Library
This library covert zOSMF Rest API with kotlin object oriented code using Retrofit. r2z will allow you to send http requests to your zOSMF.

## Installation
To install this library in your project use one of build tools like Maven, Gradle or Ant. Use the link below to get necessary artifacts.
https://mvnrepository.com/artifact/eu.ibagroup/r2z
```xml
<dependency>
<groupId>eu.ibagroup</groupId>
<artifactId>r2z</artifactId>
<version>{version}</version>
</dependency>
```

## Guide
In r2z you can find ...API classes. They can be used to send requests to zOSMF. Besides API classes there located data classes like Dataset. Their purpose is to wrap a response from the server or a request into it using an object model. let's look at an example.
```kotlin
// Create stub for DataAPI interface using Retrofit. Here baseUrl is url of your zOSMF service.
val dataAPI = Retrofit.Builder()
.baseUrl(baseUrl)
.addConverterFactory(GsonConverterFactory.create())
.client(client)
.build()
.create(DataAPI::class.java)

// You can use basic authentication to access zOSMF.
val basicCreds = Credentials.basic(zosmfUser, zosmfPassword) ?: ""

// Call method you need and get Request object.
val request = dataAPI.listDatasetMembers(
authorizationToken = basicCreds,
datasetName = "EXAMPLE.DATASET"
)

// Execute request to get Response object.
val response = request.execute()

// If the request went well you can get result from response body.
if (response.isSuccessful){
val members = response.body();
}
```
Please note that in order to create API stub, you have to specify that the response should be converted by gson. And that's how you can easily use r2z.
145 changes: 136 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.4.21'
id 'org.jetbrains.kotlin.jvm' version '1.4.30'
}


apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'maven-publish'

archivesBaseName = 'r2z'
group 'eu.ibagroup'
version '1.0-SNAPSHOT'
version projectVersion

repositories {
mavenCentral()
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
languageVersion = "1.4"
}
}

artifacts {
archives sourcesJar
repositories {
mavenCentral()
}

dependencies {
Expand All @@ -34,4 +45,120 @@ dependencies {

test {
useJUnitPlatform()
}


task sourceJar(type: Jar) {
classifier "sources"
from sourceSets.main.allJava
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier "javadoc"
from javadoc.destinationDir
}

artifacts {
archives jar
archives sourceJar
archives javadocJar
}

signing {
sign configurations.archives
required {
// signing is required if this is a release version and the artifacts are to be published
!version.toString().endsWith('-SNAPSHOT') && tasks.withType(PublishToMavenRepository).find {
gradle.taskGraph.hasTask it
}
}
sign publishing.publications
}


publishing {
publications {
mavenJava(MavenPublication) {
customizePom(pom)
groupId 'eu.ibagroup'
artifactId 'r2z'
version projectVersion

from components.java


artifact(sourceJar) {
classifier = 'sources'
}
artifact(javadocJar) {
classifier = 'javadoc'
}
}
}
repositories {
maven {
url "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2"
credentials {
username ossrhUsername
password ossrhPassword
}
}
}
}
//какая-то неимоверная дичь
def customizePom(pom) {
pom.withXml {
def root = asNode()

// eliminate test-scoped dependencies (no need in maven central POMs)
root.dependencies.removeAll { dep ->
dep.scope == "test"
}

// add all items necessary for maven central publication
root.children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST

description 'Library that allows to perform http requests to IBM z/OSMF REST API with the help of Retorfit2.'
name 'Retrofit2-ZOSMF-Library'
url 'https://github.com/for-mainframe/Retrofit2-ZOSMF-Library'

issueManagement {
system 'GitHub'
url 'https://github.com/for-mainframe/Retrofit2-ZOSMF-Library/issues'
}
licenses {
license {
name 'Apache License 2.0'
url 'https://github.com/for-mainframe/Retrofit2-ZOSMF-Library/blob/main/License'
distribution 'repo'
}
}
scm {
url 'https://github.com/for-mainframe/Retrofit2-ZOSMF-Library'
connection 'scm:git:git://github.com/for-mainframe/Retrofit2-ZOSMF-Library.git'
developerConnection 'scm:git:[email protected]:for-mainframe/Retrofit2-ZOSMF-Library.git'
}
developers {
developer {
id 'formainframe'
name 'For Mainframe'
email '[email protected]'
}
}
}
}
}


model {
tasks.generatePomFileForMavenJavaPublication {
destination = file("$buildDir/generated-pom.xml")
}
tasks.publishMavenJavaPublicationToMavenLocal {
dependsOn project.tasks.signArchives
}
tasks.publishMavenJavaPublicationToMavenRepository {
dependsOn project.tasks.signArchives
}
}
10 changes: 10 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
kotlin.code.style=official

ossrhUsername=formainframe
ossrhPassword=865503b1%Qwerty

signing.keyId=FADC1195
signing.password=865503b1_formf
signing.secretKeyRingFile=path/to/secret/key

projectVersion=1.0.2
Loading

0 comments on commit 9a972b4

Please sign in to comment.