Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
b439fd8
init files
Feb 11, 2022
9206915
new update
Feb 11, 2022
8332400
migration
Mar 22, 2022
b20492a
test commit
arihantjain97 Mar 22, 2022
172154f
Repo merge from ppe-1: AEP, BPM
arihantjain97 Mar 22, 2022
b8a0e47
API 2.3.0 Testing: AEP, BPM dump
arihantjain97 Mar 23, 2022
957849f
test
dylanyeoEnvision Mar 22, 2022
8c0f8ea
Delete main.py
Mar 22, 2022
2b84535
API 2.3.0 Testing: IAMService, notification management
arihantjain97 Mar 25, 2022
2a7a192
removed personal info
arihantjain97 Mar 25, 2022
4a3e024
DataFed and BatchProcessing dump
arihantjain97 Mar 29, 2022
c23a506
API 2.3.0 Testing (Bug fix): DeviceData
arihantjain97 Mar 29, 2022
4b14a6f
replenish openApi(v2.4)
Sep 22, 2022
f007fc4
delete log api
Sep 23, 2022
96d23e5
BatchCreateDevice fix
Oct 11, 2022
3712020
Feature dcm
Oct 25, 2022
ab77a53
SearchCommand fix
Oct 28, 2022
e822e32
refact the folder
hunan2-envison Nov 15, 2022
96ecbf4
refact the folder
hunan2-envison Nov 15, 2022
64a9ee2
Add new file
Nov 15, 2022
69bf991
readme
StephanieEnvision Nov 16, 2022
6ee3672
raedme update
StephanieEnvision Nov 16, 2022
fe8f642
add metric sample api
Oct 19, 2022
76813b8
add metric sample api
Oct 19, 2022
d6b2c3e
AMC-8242: feature: Onboarding API的sample code.
Jan 10, 2023
632c417
fix http integration url scheme
mingwang4 Mar 2, 2023
4b725ad
env demo
hunan2-envison Apr 3, 2023
0134aae
Update environment_variables.md
StephanieEnvision Apr 3, 2023
f630f40
Update environment_variables.md
StephanieEnvision Apr 3, 2023
fee73c9
fix NPE
mingwang4 Apr 4, 2023
780fab6
remove sensitive info
mingwang4 Apr 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/target
/.idea
/.idea/.gitignore
/.idea/compiler.xml
/.idea/encodings.xml
/.idea/jarRepositories.xml
/.idea/misc.xml
/.idea/vcs.xml
.DS_Store
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
# sample-code-java
# Java Sample Code

## About

This repository includes code samples to use EnOS™ APIs in Java. To learn more about EnOS™ APIs, see [EnOS API Documentation](https://support.envisioniot.com/docs/api/en/2.4.0/overview.html).


## Prerequisites

Before using the code samples, complete the tasks described in [Using Java SDK](https://support.envisioniot.com/docs/api/en/2.4.0/gettingstarted.html#using-java-sdk).


## Using the Code Samples

You need to replace the [environment variables](environment_variables.md) with the actual values you want to use.

## Release Notes

2022/12/30
Empty file added SampleFirmwareFile.bin
Empty file.
8 changes: 8 additions & 0 deletions UploadFileSample.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Envision Digital is committed to becoming the world’s leading net zero technology partner for enterprises, governments,
and cities alike. Its world-class AIoT technology helps governments and companies across the world accelerate progress
toward a net zero future and improve their citizens’ quality of life. Having established itself as a leading solutions
provider for intelligent renewable energy generation, consumption efficiency and smart and flexible storage,
Envision Digital has extended its capabilities beyond energy to enable and optimise applications
– notably in smart renewables, city infrastructure and carbon management solutions.

test
3 changes: 3 additions & 0 deletions environment_variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
|Parameter Name|Description|Type|Default Value|Mandatory/Optional|How to get|Note|
| --- | ---| ---| --- | ---| ---|---|
|orgId|The organization ID.| Integer| N/A | Mandatory | In the left navigation bar of the EnOS Management Console, click IAM > Organization Profile . The Organization ID is the orgld.| None|
191 changes: 191 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
<?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>com.envisioniot.example</groupId>
<artifactId>Sample1</artifactId>
<version>1.0-SNAPSHOT</version>

<name>Sample1</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>com.envisioniot</groupId>
<artifactId>enos-dm-api-pojo</artifactId>
<version>2.4.2-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.envisioniot</groupId>
<artifactId>enos-mqtt</artifactId>
<version>2.2.15</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
</dependency>

<dependency>
<groupId>com.envisioniot</groupId>
<artifactId>enos-core</artifactId>
<version>0.2.0</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.12.3</version>
</dependency>
<dependency>
<groupId>com.vaadin.external.google</groupId>
<artifactId>android-json</artifactId>
<version>0.0.20131108.vaadin1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.envisioniot</groupId>
<artifactId>enos-http-integration</artifactId>
<version>0.1.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.0-alpha5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.0-alpha5</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>com.envisioniot</groupId>
<artifactId>apim-poseidon</artifactId>
<version>0.1.14</version>
</dependency>
<dependency>
<groupId>com.envisioniot</groupId>
<artifactId>enos-app-portal-sdk</artifactId>
<version>0.0.15-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.envisioniot.enos</groupId>
<artifactId>amc-api-pojo</artifactId>
<version>0.0.5-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>apim-poseidon</artifactId>
<groupId>com.envisioniot</groupId>
</exclusion>
<exclusion>
<artifactId>enos-commons-api-pojo</artifactId>
<groupId>com.envisioniot</groupId>
</exclusion>
</exclusions>
</dependency>


</dependencies>

<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
147 changes: 147 additions & 0 deletions src/main/java/com/envisioniot/example/sample/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
package com.envisioniot.example.sample;

import java.io.IOException;

import com.envisioniot.example.sample.connection.devicedata.ConnectionDeviceDataApp;
import com.envisioniot.example.sample.onboarding.AmcApp;
import com.envisioniot.example.sample.utility.PropertyUtil;

/**
* API 2.3.0 testing
*/
public class App {
private static String accessKey;
private static String secretKey;
private static String orgId;
private static String url;

public static void main(String[] args) {
// Preconfiguration
PropertyUtil pptfile = null;
try {
pptfile = new PropertyUtil("env.properties");
} catch (IOException e) {
e.printStackTrace();
}
accessKey = pptfile.getProperty("accessKey");
secretKey = pptfile.getProperty("secretKey");
orgId = pptfile.getProperty("orgId");
url = pptfile.getProperty("url");

/* Run GetThings */
// https://support.envisioniot.com/docs/model-api/en/2.3.0/overview.html
/*
ModelApp model = new ModelApp();
model.modelappGeneral(accessKey, secretKey, orgId, url);
*/

/* Connection Service */

// Connection Service - Product
// https://support.envisioniot.com/docs/connection-api/en/2.3.0/overview.html
/*
ConnectionProductApp product = new ConnectionProductApp();
product.connectionProductAppGeneral(accessKey, secretKey, orgId, url);
*/

// Connection Service - Device
// https://support.envisioniot.com/docs/connection-api/en/2.3.0/index_device.html
/*
ConnectionDeviceApp device = new ConnectionDeviceApp();
device.connectionDeviceAppGeneral(accessKey, secretKey, orgId, url);
*/

// Connection Service - Certificate
// https://support.envisioniot.com/docs/connection-api/en/2.3.0/index_certificate.html
/*
ConnectionCertificateApp certificate = new ConnectionCertificateApp();
certificate.connectionCertificateAppGeneral(accessKey, secretKey, orgId, url);
*/

// Connection Services - Gateway and Sub-Device
// https://support.envisioniot.com/docs/connection-api/en/2.3.0/index_gateway_subdevice.html
/*
ConnectionGatewayAndSubdeviceApp gatewayandsubdevice = new ConnectionGatewayAndSubdeviceApp();
gatewayandsubdevice.connectionGatewayAndSubdeviceAppGeneral(accessKey, secretKey, orgId, url);
*/

// Connection Services - Device Data
// https://support.envisioniot.com/docs/connection-api/en/2.3.0/index_device_data.html

// ConnectionDeviceDataApp devicedata = new ConnectionDeviceDataApp();
// devicedata.connectionDeviceDataAppGeneral(accessKey, secretKey, orgId, url);

// Connection Services - HTTP Message Integration
// https://support.envisioniot.com/docs/connection-api/en/2.3.0/index_integration.html
/*
ConnectionHttpApp http = new ConnectionHttpApp();
http.connectionHttpApp(accessKey,secretKey,orgId,url);
*/

// Connection Services - Firmware Management
// https://support.envisioniot.com/docs/connection-api/en/2.3.0/index_firmware.html
/*
ConnectionFirmwareManagementApp firmwaremanagement = new ConnectionFirmwareManagementApp();
firmwaremanagement.connectionFirmwareManagement(accessKey, secretKey, orgId, url);
*/

// Connection Services - Firmware OTA upgrade Management
// https://support.envisioniot.com/docs/connection-api/en/2.3.0/index_ota.html

/* ConnectionFirmwareOTAupgradeManagementApp firmwareotaupgrademanagement = new ConnectionFirmwareOTAupgradeManagementApp();
firmwareotaupgrademanagement.firmwareOTAupgradeManagement(accessKey, secretKey, orgId, url);*/

// Asset Service
// https://support.envisioniot.com/docs/asset-api/en/2.3.0/overview.html

/* AssetApp asset = new AssetApp();
asset.assetAppGeneral(accessKey, secretKey, orgId, url);*/

// Alert
// https://support.envisioniot.com/docs/alert-api/en/2.3.0/overview.html
/*
AlertApp alert = new AlertApp();
alert.alertAppGeneral(accessKey, secretKey, orgId, url);
*/

/* //Stream Processing Services, Get Stage State

StreamProcessingApp streamprocessingapp = new StreamProcessingApp();
streamprocessingapp.streamProcessingAppGeneral(accessKey, secretKey, orgId, url);*/

// TSDP Policy
/* TSDBPolicyApp tsdbpolicyapp = new TSDBPolicyApp();
tsdbpolicyapp.tsdbPolicyAppGeneral(accessKey, secretKey, orgId, url);*/

// TSDBDataApp tsdbdataapp = new TSDBDataApp();
// tsdbdataapp.tsdbDataAppGeneral(accessKey, secretKey, orgId, url);

// Data Federation
/* DataFederationApp datafederationapp = new DataFederationApp();
datafederationapp.dataFederationAppGeneral(accessKey, secretKey, orgId, url);*/

/* // Batch Processing
BatchProcessingApp batchprocessingapp = new BatchProcessingApp();
batchprocessingapp.batchProcessingAppGeneral(accessKey, secretKey, orgId, url);*/

/* AppPortalApp appPortalApp = new AppPortalApp();
appPortalApp.appPortalGeneral(accessKey, secretKey, orgId, url);*/

/*
BpmApp bpmApp = new BpmApp();
bpmApp.bpmAppGeneral(accessKey, secretKey, orgId, url);
*/

/* IAMApp iamApp = new IAMApp();
iamApp.IAMAppGeneral(accessKey, secretKey, orgId, url);*/

/* NotificationManagementApp notificationManagementApp = new NotificationManagementApp();
notificationManagementApp.notificationManagementApp(accessKey, secretKey, orgId, url);*/

// EnOS Onboarding Tool API Overview
AmcApp amcApp = new AmcApp();
amcApp.amcAppGeneral(accessKey, secretKey, orgId, url);

}

}
Loading