Skip to content

Commit

Permalink
Adding documentation
Browse files Browse the repository at this point in the history
Adding more README for how to use the SDK per package
#17
  • Loading branch information
czfdcn committed Aug 24, 2023
1 parent 2aa3f03 commit 4bf89a8
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 55 deletions.
76 changes: 21 additions & 55 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
image:https://github.com/eclipse-uprotocol/.github/raw/main/logo/uprotocol_logo.png[alt=uProtocol,640]

image:https://img.shields.io/badge/License-Apache%202.0-blue.svg[License,link=https://opensource.org/licenses/Apache-2.0]

= Eclipse uProtocol Java SDK
:toc:

== Overview

The main object of this module is to enable constructing and deconstructing uProtocol CloudEvents.

The core module contains functional factory methods for creating CloudEvents as well as functional factory methods that make it more intuitive to create URIs that are used to configure source and sink (destination) elements in the uProtocol CloudEvents.
The purpose of this module is to provide language specific code that builds the various data types defined in . The SDK also defines https://github.com/eclipse-uprotocol/uprotocol-spec/tree/main[uProtocol Specifications].

This module contains the data model structures as well as core functionality for building uProtocol CloudEvents and URIs for sink and source attributes.
The module contains factory methods and validators for all data types used in uProtocol.

The SDKs are then used by the code generators to auto-populate service stubs with generated code that builds CloudEvents. For more information on auto-generating service stubs, please refer to http://github.com/eclipse-uprotocol/uprotocol[uProtocol Main Project]

Expand All @@ -28,57 +22,29 @@ The SDKs are then used by the code generators to auto-populate service stubs wit
</dependency>
----

=== Using the sdk

=== UriFactory

Matches the uProtocol URI Format. and is used to define source and sink (destination) attributes of uProtocol CloudEvents.
The factory builds URIs.

URI is used as a method to uniquely identify devices, services, and resources on the network.

*An Uri is built from the following elements:*

* *UAuthority* - represents the device and domain of the software, the deployment. You can specify local or remote options.
* *UEntity* - The Software Entity defines the software name and version.
* *UResource* - The resource of the software can be a service name, and instance in the service and the name of the protobuf IDL message.

==== UAuthority

An Authority consists of a device and a domain per uProtocol URI format.

An Authority represents the deployment location of a specific Software Entity.

==== UEntity - uE

An Software Entity is a piece of software deployed somewhere on a device. The uE is used in the source and sink parts of communicating software.

A uE that *publishes* events is a *Service* role.

A uE that *consumes* events is an *Application* role.

A uE may combine bother Service and Application roles.


==== UResource

A service API - defined in the uE - has Resources and Methods. Both of these are represented by the UResource class.

An UResource is something that can be manipulated/controlled/exposed by a service.

Resources are unique when prepended with UAuthority that represents the device and Software Entity that represents the service.

An Resource represents a resource from a Service such as "door" and an optional specific instance such as "front_left".
In addition, it can optionally contain the name of the resource Message type, such as "Door".
The SDK is composed of 4 main packages as shown in <<sdk-packages>> below:

The Message type matches the protobuf service IDL that defines structured data types. A message is a data structure type used to define data that is passed in events and rpc methods.
.SDK Packages
[#sdk-packages,width=100%,cols="15%,25%,60%"]
|===
| Package | https://github.com/eclipse-uprotocol/uprotocol-spec[uprotocol-spec] | Purpose

=== CloudEventFactory
Factory class that builds the various types of CloudEvents for uProtocol (publish, notification, request, response)
| link:src/main/java/org/eclipse/uprotocol/uri/README.adoc[`uuri`]
| https://github.com/eclipse-uprotocol/uprotocol-spec/blob/main/basics/uri.adoc[URI, UAthority, UEntity, UResource]
| Uniform Resource Identifier (RFC3986) used to address things (devices, software, methods, topics, etc...) on the network

== Examples
| link:src/main/java/org/eclipse/uprotocol/cloudevent/README.adoc[`cloudevent`]
| https://github.com/eclipse-uprotocol/uprotocol-spec/blob/main/up-l1/cloudevents.adoc[uProtocol CloudEvents]
| Common way to represent uProtocol messages using CloudEvent data model

The SDK contains comprehensive tests, the best place to look at how all the APIs are used are at:
| link:src/main/java/org/eclipse/uprotocol/uuid/README.adoc[`uuid`]
| https://github.com/eclipse-uprotocol/uprotocol-spec/blob/main/basics/uuid.adoc[uProtocol UUIDs]
| Identifier used to uniquely identify messages that are sent between devices. also includes timestamp for the message

* link:src/test/java/org/eclipse/uprotocol/uri/factory/UriFactoryTest.java[UriFactoryTest.java]
| link:src/main/java/org/eclipse/uprotocol/utransport/README.adoc[`utransport`]
| https://github.com/eclipse-uprotocol/uprotocol-spec/blob/main/up-l1/README.adoc[uP-L1 Specifications]
| Interface (and data model) used for bidirectional point-2-point communication between uEs. Interface is to be implemented by the different communication technologies (ex. Binder, MQTT, Zenoh, SOME/IP, DDS, HTTP, etc…​)

* link:src/test/java/org/eclipse/uprotocol/cloudevent/factory/CloudEventFactoryTest.java[CloudEventFactoryTest.java]
|===
21 changes: 21 additions & 0 deletions src/main/java/org/eclipse/uprotocol/cloudevent/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
= uProtocol CloudEvents
:toc:
:sectnums:


== Overview

https://github.com/eclipse-uprotocol/uprotocol-spec/blob/main/up-l1/cloudevents.adoc[uProtocol CloudEvents] is a common message envelope that could be used to carry way to represent uProtocol transport layer information `UUri` (source), `UPayload`, and `UAttributes`. `CloudEvents` are used by a number of Device-2-Cloud and Cloud-2-Device based transports such as MQTT and HTTP, however it could also be used by any transport (ex. Binder).

NOTE: CloudEvent is not, nor was not, meant to be _the_ only message format used below or above the transport layer.

=== CloudEventFactory
Factory class that builds the various types of CloudEvents for uProtocol (publish, notification, request, response)

== Examples

The SDK contains comprehensive tests, the best place to look at how all the APIs are used are at:

* link:src/test/java/org/eclipse/uprotocol/uri/factory/UriFactoryTest.java[UriFactoryTest.java]

* link:src/test/java/org/eclipse/uprotocol/cloudevent/factory/CloudEventFactoryTest.java[CloudEventFactoryTest.java]
7 changes: 7 additions & 0 deletions src/main/java/org/eclipse/uprotocol/rpc/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
= uProtocol Rpc Interfaces
:toc:
:sectnums:

== Overview

_comming soon_
51 changes: 51 additions & 0 deletions src/main/java/org/eclipse/uprotocol/uri/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
= uProtocol URI
:toc:
:sectnums:


== Overview

The following folder contains the data model, factory, and validators to implement https://github.com/eclipse-uprotocol/uprotocol-spec/blob/main/basics/uri.adoc[uProtocol URI Specifications]

Matches the uProtocol URI Format. and is used to define source and sink (destination) attributes of uProtocol.
The factory builds URIs.

URI is used as a method to uniquely identify devices, services, and resources on the network.

== UUri

*An Uri is built from the following elements:*

* *UAuthority* - represents the device and domain of the software, the deployment. You can specify local or remote options.
* *UEntity* - The Software Entity defines the software name and version.
* *UResource* - The resource of the software can be a service name, and instance in the service and the name of the protobuf IDL message.

=== UAuthority

An Authority consists of a device and a domain per uProtocol URI format.

An Authority represents the deployment location of a specific Software Entity.

=== UEntity - uE

An Software Entity is a piece of software deployed somewhere on a device. The uE is used in the source and sink parts of communicating software.

A uE that *publishes* events is a *Service* role.

A uE that *consumes* events is an *Application* role.

A uE may combine bother Service and Application roles.


=== UResource

A service API - defined in the uE - has Resources and Methods. Both of these are represented by the UResource class.

An UResource is something that can be manipulated/controlled/exposed by a service.

Resources are unique when prepended with UAuthority that represents the device and Software Entity that represents the service.

An Resource represents a resource from a Service such as "door" and an optional specific instance such as "front_left".
In addition, it can optionally contain the name of the resource Message type, such as "Door".

The Message type matches the protobuf service IDL that defines structured data types. A message is a data structure type used to define data that is passed in events and rpc methods.
7 changes: 7 additions & 0 deletions src/main/java/org/eclipse/uprotocol/utransport/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
= uProtocol Transport Interface & Data Model
:toc:
:sectnums:
:source-highlighter: prettify

== Overview
The purpose of this moduel is to provide the Java implementation of https://github.com/eclipse-uprotocol/uprotocol-spec/blob/main/up-l1/README.adoc[uTransport API & Data Model]. The transport API is used by all uE developers to send and receive messages across any transport. The interface is to be implemented by communication transport developers (i.e. developing a uTransport for SOME/IP, DDS, Zenoh, MQTT, etc...).
8 changes: 8 additions & 0 deletions src/main/java/org/eclipse/uprotocol/uuid/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
= uProtocol UUID
:toc:
:sectnums:

== Overview

_comming soon_

0 comments on commit 4bf89a8

Please sign in to comment.