- Switched to providing the version of edgent libs via dependencyManagement as there were issues with overriding the version if the property is only defined in the parent.
7 files changed
tree: dca7248da727fa9b2ab84ddfa747e0c0853e77a7
  1. .gitignore
  2. .mailmap
  3. .mvn/
  4. APPLICATION_DEVELOPMENT.md
  5. CONTRIBUTORS
  6. DEVELOPMENT.md
  7. LICENSE
  8. NOTICE
  9. README.md
  10. apps/
  11. connectors/
  12. console/
  13. cron/
  14. get-edgent-jars-project/
  15. mvnw
  16. mvnw.cmd
  17. package-app.sh
  18. pom.xml
  19. scenarios/
  20. src/
  21. template/
  22. topology/
  23. update-samples-version.sh
  24. utils/
README.md

Quickstart

If you haven't already done so, download the samples from github:

git clone https://github.com/apache/incubator-edgent-samples
cd incubator-edgent-samples
git checkout develop

You must have Java 8 installed on your system. Maven will be automatically downloaded and installed by the maven wrapper mvnw.

Build the samples for Java 8

./mvnw clean package

Run the HelloEdgent sample

cd topology
./run-sample.sh HelloEdgent   # prints a hello message and terminates
  Hello
  Edgent!
  ...

Overview

The Edgent samples provide a starting point for jump starting your use of Edgent. See the Samples Summary section for a list of the samples.

The Edgent samples are organized into a few categories (subdirectories) and are a collection of maven projects. They can be built using maven or other maven-integrated tooling such as Eclipse.

An Edgent application template maven project is supplied. It may be a useful starting point to clone for your application. The template has a standalone maven project pom, rather than a stylized one used by the rest of the samples. See template/README.md.

See APPLICATION_DEVELOPMENT.md for general information on Edgent Application Development, Packaging and Execution.

Additional information may also be found in Getting Started https://edgent.apache.org/docs/edgent-getting-started

Setup

Once you have downloaded and unpacked the samples source bundle or cloned the the samples repository you need to download these additional development software tools.

  • Java 8 - The development setup assumes Java 8

Maven is used as build tool and a maven-wrapper script (mvwn or mvnw.bat) is included.

The maven-wrapper automatically downloads and installs the correct Maven version and use it. Besides this, there is no difference between using the mvnw command and the mvn command.

You may also use a maven-integrated IDE with the samples. e.g., see the Using Eclipse section below.

The samples use Edgent SDK jars that have been released in a maven repository such as Maven Central.

Alternatively, you can download the Edgent SDK sources and build them, populating your local maven repository. The samples will then use those Edgent SDK jars. Adjust the edgent.version property in the top level samples pom.xml accordingly. See downloads for downloading the Edgent SDK sources.

Building the Edgent samples

By default Java8 class files are generated. Java7 platform class files are produced when the appropriate profile is specified.

Currently, building and running the samples for the Android platform is not supported. Many samples happen to use the DevelopmentProvider, which is not supported on the Android platform.

Build the samples

./mvnw clean package  # -Pplatform-java7 and/or -Dedgent.runtime.version=<the-version> as needed

A standard jar and uber jar are created for each sample category in the sample category's target directory: <category>/target.

Running the samples

See the README.md in each sample category directory for information on running the samples.

Using Eclipse

The Edgent Git repository and samples source release bundle contains Maven project definitions for the samples.

Once you import the Maven projects into your workspace, builds in Eclipse use the same artifacts as the Maven command line tooling. Like the command line tooling, the jars for dependent projects are automatically downloaded to the local maven repository and used.

If you want to use Eclipse to clone your fork, use the Eclipse Git Team Provider plugin

  1. From the Eclipse File menu, select Import...
  2. From the Git folder, select Projects from Git and click Next
  3. Select Clone URI to clone the remote repository. Click Next.
    • In the Location section, enter the URI of your fork in the URI field (e.g., git@github.com:<username>/incubator-edgent.git). The other fields will be populated automatically. Click Next. If required, enter your passphrase.
    • In the Source Git Repository window, select the branch (usually master) and click Next
    • Specify the directory where your local clone will be stored and click Next. The repository will be cloned. Note: You can build and run tests using Maven in this directory.
  4. In the Select a wizard to use for importing projects window, click Cancel.
    Then follow the steps below to import the Maven projects.

Once you have cloned the Git repository to your machine or are working from an unpacked samples source release bundle, import the Maven projects into your workspace

  1. From the Eclipse File menu, select Import...
  2. From the Maven folder, select Existing Maven Projects and click Next
  • browse to the samples directory in the clone or source release directory and select it. A hierarchy of samples projects / pom.xml files will be listed and all selected.
  • Verify the Add project(s) to working set checkbox is checked
  • Click Finish. Eclipse starts the import process and builds the workspace.

Top-level artifacts such as README.md are available under the edgent-samples project.

Note: Specifics may change depending on your version of Eclipse or the Eclipse Maven or Git Team Provider.

Once the samples projects have been imported you can run them from Eclipse in the usual manner. E.g.,

  1. From the Eclipse Navigate menu, select Open Type
    • enter type type name HelloEdgent and click OK
  2. right click on the HelloEdgent class name and from the context menu
    • click on Run As, then Java application. HelloEdgent runs and prints to the Console view.

Samples Summary

Many other samples are provided but have not yet been noted above. Explore!

Licensing

Apache Edgent samples are released under the Apache License Version 2.0.

Apache Edgent is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Incubator PMC. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.