Getting started with the Edgent samples is a great way to start using Edgent and jump-start your application development.
Essentially, you download the samples source release, then easily build and run them from either the command line or from an IDE.
Then, see the Additional Resources section at the end of this page!
If you want more of an introduction to Edgent and tutorial first, see the Getting Started Guide.
Convenience binaries (jars) for the Edgent runtime releases are distributed to the ASF Nexus Repository and the Maven Central Repository. There is no need to download the Edgent runtime sources and build them unless you want to. You don't have to manually download the Edgent jars either.
By default the samples depend on Java8. Download and install Java8 if you need to.
tar zxvf apache-edgent-X.X.X-incubating-samples-source-release.tar.gz
unzip apache-edgent-X.X.X-incubating-samples-source-release.zip
You must have Java 8 installed on your system. Maven will be automatically downloaded and installed by the maven wrapper mvnw
.
In the unpacked samples folder...
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! ...
For your application project, you can clone the template project. In the unpacked samples folder
cp -R template ~/myApp
Verify the setup
cd ~/myApp ./mvnw clean package ./app-run.sh # prints a hello message
See README.md
in the new project folder for more information.
Here we'll use Eclipse for the development environment. Another popular choice is the maven-integrated IntelliJ IDE.
See eclipse.org if you need to download Eclipse. It's easiest if you choose a package that includes the Maven integration. Otherwise, update your Eclipse installation with the Eclipse Maven Integration.
This remainder of this getting started information assumes a basic understanding of Eclipse.
Note: Specifics may change depending on your version of Eclipse or the Eclipse Maven plugin.
Import the samples into your Eclipse workspace:
Top-level artifacts such as the README.md
file are available under the edgent-samples
project.
Once the samples have been imported you can run them from Eclipse in the usual manner. E.g.,
HelloEdgent
and click OKHelloEdgent
class name and from the context menuHelloEdgent
runs and prints to the Console view.To clone the template project for your application project:
my-app
. This can be renamed later.Verify you can run the imported template app:
TemplateApp
and click OKTemplateApp
class name and from the context menuTemplateApp
runs and prints to the Console view.You can then start adding your application's java code.
Review the README.md
file in the newly imported project's folder.
The project's pom.xml
file is heavily commented to ease specifying dependencies to various Edgent jars. Open it and select the pom.xml
tab in the Maven POM Editor to view the comments. If needed, change the edgent.runtime.version
property to the desired Edgent version. When needed, adjust the Edgent jar dependencies.
Optionally, rename the Java class, Java package, project's folder, and change maven project information.
my-app
project, then the src/main/java
folder, then the com.mycompany.app
package. Right click on TemplateApp.java
and select Refactor and Rename...com.mycompany.app
package and select Refactor and Rename...my-app
project select Refactor and Rename...You can continue to explore the samples. The README.md in the unpacked samples folder summarize what is available, as well as more information about building and running them.
As noted above, the samples include a template project that you can clone for your application.
Some additional development tools are provided with the samples, in particular, get-edgent-jars.sh
and package-app.sh
. See Edgent Application Development.
The Getting Started Guide identifies other resources.