Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aaitor committed Feb 3, 2020
1 parent 817a3c7 commit c521f21
Show file tree
Hide file tree
Showing 91 changed files with 10,738 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: W3M Schemas Build

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.11
uses: actions/setup-java@v1
with:
java-version: 1.11
- name: Build with Maven
run: mvn -B package --file pom.xml

42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,40 @@
# web3-monitoring-schemas
Web3 Monitoring Schemas in Avro format
# Web3 Monitoring data Schemas

Web3 Monitoring platform schemas definition in Avro format.

You can generate the ZIP including the avro schemas and the Java stubs using the following command:

```
mvn clean package
```

After finish in the target folder you will find:
* The ZIP file including the Avro schemas
* A Jar file including the Java stubs generated using the schemas

## Requirements

* Maven 3
* Java 11

## Dependency

You can include the stubs generated with the schemas including the following dependency:

```
<dependency>
<groupId>io.keyko.monitoring</groupId>
<artifactId>schemas</artifactId>
<version>0.1.0</version>
</dependency>
```

## Schemas

The AVRO implementation of the schemas can be found in the **src/main/resources/avro/** folder. This are the schemas implemented:

* BlockEvent.avsc
* ContractEvent.avsc
* EventBlock.avsc
* TransactionEvent.avsc

145 changes: 145 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.keyko.monitoring</groupId>
<artifactId>schemas</artifactId>
<packaging>jar</packaging>
<version>0.1.0</version>

<description>
Web3 Monitoring data models in AVRO format
</description>

<licenses>
<license>
<name>Apache License 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
<distribution>repo</distribution>
</license>
</licenses>

<properties>
<java.version>11</java.version>
<avro.version>1.9.1</avro.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
<version>${avro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>${avro.version}</version>
</dependency>

<dependency>
<groupId>com.github.fge</groupId>
<artifactId>json-schema-avro</artifactId>
<version>0.1.4</version>
</dependency>

</dependencies>

<build>

<plugins>


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<inherited>true</inherited>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>${avro.version}</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>schema</goal>
<goal>idl-protocol</goal>
</goals>
<configuration>
<sourceDirectory>src/main/resources/avro/</sourceDirectory>
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
<stringType>String</stringType>
<enableDecimalLogicalType>true</enableDecimalLogicalType>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<finalName>web3-monitoring-schemas-${project.version}</finalName>
<descriptors>
<descriptor>src/assembly/schemas.xml</descriptor>
<descriptor>src/assembly/dependency.xml</descriptor>
</descriptors>
<attach>false</attach>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
</configuration>
</plugin>

<plugin>
<!--
See https://wiki.jasig.org/display/LIC/maven-notice-plugin
In a nutshell: `mvn notice:check` and `mvn notice:generate`
-->
<groupId>org.jasig.maven</groupId>
<artifactId>maven-notice-plugin</artifactId>
<version>1.0.6.1</version>
<configuration>
<licenseMapping>
<param>../license-mappings.xml</param>
</licenseMapping>
</configuration>
</plugin>

</plugins>

</build>

</project>
30 changes: 30 additions & 0 deletions src/assembly/dependency.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
http://maven.apache.org/xsd/assembly-1.1.2.xsd">

<id>dependency</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>${file.separator}</outputDirectory>
<includes>
<include>README*</include>
<include>LICENSE*</include>
<include>NOTICE*</include>
</includes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
</assembly>
20 changes: 20 additions & 0 deletions src/assembly/schemas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
http://maven.apache.org/xsd/assembly-1.1.2.xsd">

<id>schemas</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>src/main/resources/avro</directory>
<outputDirectory>${file.separator}</outputDirectory>
<includes>
<include>**/*.avsc</include>
</includes>
</fileSet>
</fileSets>
</assembly>
46 changes: 46 additions & 0 deletions src/main/resources/avro/BlockEvent.avsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"namespace": "io.keyko.monitoring.schemas",
"type": "record",
"name": "BlockEvent",
"fields": [
{
"name": "id",
"type": "string"
},
{
"name": "type",
"type": "string"
},
{
"name": "details",
"type": {
"type": "record",
"name": "BlockDetails",
"fields": [
{
"name": "number",
"type": "string",
"java-class": "java.math.BigInteger"
},
{
"name": "hash",
"type": "string"
},
{
"name": "timestamp",
"type": "string",
"java-class": "java.math.BigInteger"
},
{
"name": "nodeName",
"type": "string"
}
]
}
},
{
"name": "retries",
"type": "int"
}
]
}
Loading

0 comments on commit c521f21

Please sign in to comment.