Skip to content

Commit 889dcc1

Browse files
committed
Checkstyle fixes.
1 parent 099b6ce commit 889dcc1

File tree

17 files changed

+39
-16
lines changed

17 files changed

+39
-16
lines changed

iot/api/README.md renamed to iot/api-client/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Cloud IoT Core NodeJS Samples
2-
This folder contains NodeJS samples that demonstrate an overview of the
1+
# Cloud IoT Core Java Samples
2+
This folder contains Java samples that demonstrate an overview of the
33
Google Cloud IoT Core platform.
44

55
## Quickstart
File renamed without changes.
File renamed without changes.

iot/api/manager/pom.xml renamed to iot/api-client/manager/pom.xml

+8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@
2323
<name>cloudiot-manager-demo</name>
2424
<url>http://maven.apache.org</url>
2525

26+
<!-- Parent defines config for testing & linting. -->
27+
<parent>
28+
<artifactId>doc-samples</artifactId>
29+
<groupId>com.google.cloud</groupId>
30+
<version>1.0.0</version>
31+
<relativePath>../../../</relativePath>
32+
</parent>
33+
2634
<!-- Start local repo -->
2735
<repositories>
2836
<!-- Use a local directory for the Cloud IoT Core API dependency. -->

iot/api/manager/src/main/java/com/google/cloud/iot/examples/DeviceRegistryExample.java renamed to iot/api-client/manager/src/main/java/com/google/cloud/iot/examples/DeviceRegistryExample.java

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import com.google.api.services.cloudiot.v1beta1.model.NotificationConfig;
3131
import com.google.api.services.cloudiot.v1beta1.model.PublicKeyCredential;
3232
import com.google.common.io.Files;
33+
3334
import java.io.File;
3435
import java.io.IOException;
3536
import java.security.GeneralSecurityException;

iot/api/manager/src/main/java/com/google/cloud/iot/examples/DeviceRegistryExampleOptions.java renamed to iot/api-client/manager/src/main/java/com/google/cloud/iot/examples/DeviceRegistryExampleOptions.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import org.apache.commons.cli.Options;
2121
import org.apache.commons.cli.ParseException;
2222

23-
/** Command line options for the Device Manager example */
23+
/** Command line options for the Device Manager example. */
2424
public class DeviceRegistryExampleOptions {
2525
String projectId;
2626
String pubsubTopic;
@@ -29,7 +29,7 @@ public class DeviceRegistryExampleOptions {
2929
String cloudRegion = "us-central1";
3030

3131
/** Construct an DeviceRegistryExampleOptions class from command line flags. */
32-
public static DeviceRegistryExampleOptions fromFlags(String args[]) {
32+
public static DeviceRegistryExampleOptions fromFlags(String[] args) {
3333
Options options = new Options();
3434
// Required arguments
3535
options.addOption(

iot/api/manager/src/main/java/com/google/cloud/iot/examples/RetryHttpInitializerWrapper.java renamed to iot/api-client/manager/src/main/java/com/google/cloud/iot/examples/RetryHttpInitializerWrapper.java

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.google.api.client.util.ExponentialBackOff;
2424
import com.google.api.client.util.Sleeper;
2525
import com.google.common.base.Preconditions;
26+
2627
import java.io.IOException;
2728
import java.util.logging.Logger;
2829

iot/api/mqtt_example/pom.xml renamed to iot/api-client/mqtt_example/pom.xml

+12
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,27 @@
77
<version>1.0</version>
88
<name>cloudiot-mqtt-example</name>
99
<url>http://maven.apache.org</url>
10+
1011
<properties>
1112
<maven.compiler.source>1.7</maven.compiler.source>
1213
<maven.compiler.target>1.7</maven.compiler.target>
1314
</properties>
15+
16+
<!-- Parent defines config for testing & linting. -->
17+
<parent>
18+
<artifactId>doc-samples</artifactId>
19+
<groupId>com.google.cloud</groupId>
20+
<version>1.0.0</version>
21+
<relativePath>../../../</relativePath>
22+
</parent>
23+
1424
<repositories>
1525
<repository>
1626
<id>Eclipse Paho Repo</id>
1727
<url>https://repo.eclipse.org/content/repositories/paho-releases/</url>
1828
</repository>
1929
</repositories>
30+
2031
<dependencies>
2132
<dependency>
2233
<groupId>org.eclipse.paho</groupId>
@@ -39,4 +50,5 @@
3950
<version>1.3</version>
4051
</dependency>
4152
</dependencies>
53+
4254
</project>

iot/api/mqtt_example/src/main/java/com/google/cloud/iot/examples/MqttExample.java renamed to iot/api-client/mqtt_example/src/main/java/com/google/cloud/iot/examples/MqttExample.java

+10-9
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@
33
import io.jsonwebtoken.JwtBuilder;
44
import io.jsonwebtoken.Jwts;
55
import io.jsonwebtoken.SignatureAlgorithm;
6-
import java.nio.file.Files;
7-
import java.nio.file.Paths;
8-
import java.security.KeyFactory;
9-
import java.security.PrivateKey;
10-
import java.security.spec.PKCS8EncodedKeySpec;
116
import org.eclipse.paho.client.mqttv3.MqttClient;
127
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
138
import org.eclipse.paho.client.mqttv3.MqttMessage;
149
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
1510
import org.joda.time.DateTime;
1611

12+
import java.nio.file.Files;
13+
import java.nio.file.Paths;
14+
import java.security.KeyFactory;
15+
import java.security.PrivateKey;
16+
import java.security.spec.PKCS8EncodedKeySpec;
17+
1718
/**
1819
* Java sample of connecting to Google Cloud IoT Core vice via MQTT, using JWT.
1920
*
@@ -46,7 +47,7 @@ private static PrivateKey loadKeyFile(String filename, String algorithm) throws
4647
return kf.generatePrivate(spec);
4748
}
4849

49-
/** Create a Cloud IoT Core JWT for the given project id, signed with the given private key */
50+
/** Create a Cloud IoT Core JWT for the given project id, signed with the given private key. */
5051
private static String createJwt(String projectId, String privateKeyFile, String algorithm)
5152
throws Exception {
5253
DateTime now = new DateTime();
@@ -97,9 +98,9 @@ public static void main(String[] args) throws Exception {
9798
// connection to your device.
9899
connectOptions.setMqttVersion(MqttConnectOptions.MQTT_VERSION_3_1_1);
99100

100-
// With Google Cloud IoT Core, the username field is ignored, however it must be set for the Paho
101-
// client library to send the password field. The password field is used to transmit a JWT to
102-
// authorize the device.
101+
// With Google Cloud IoT Core, the username field is ignored, however it must be set for the
102+
// Paho client library to send the password field. The password field is used to transmit a JWT
103+
// to authorize the device.
103104
connectOptions.setUserName("unused");
104105
connectOptions.setPassword(
105106
createJwt(options.projectId, options.privateKeyFile, options.algorithm).toCharArray());

iot/api/mqtt_example/src/main/java/com/google/cloud/iot/examples/MqttExampleOptions.java renamed to iot/api-client/mqtt_example/src/main/java/com/google/cloud/iot/examples/MqttExampleOptions.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import org.apache.commons.cli.Options;
88
import org.apache.commons.cli.ParseException;
99

10-
/** Command line options for the MQTT example */
10+
/** Command line options for the MQTT example. */
1111
public class MqttExampleOptions {
1212
String projectId;
1313
String registryId;
@@ -20,7 +20,7 @@ public class MqttExampleOptions {
2020
short mqttBridgePort = 8883;
2121

2222
/** Construct an MqttExampleOptions class from command line flags. */
23-
public static MqttExampleOptions fromFlags(String args[]) {
23+
public static MqttExampleOptions fromFlags(String[] args) {
2424
Options options = new Options();
2525
// Required arguments
2626
options.addOption(
File renamed without changes.
File renamed without changes.

iot/api/scripts/iam.py renamed to iot/api-client/scripts/iam.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python
22

3-
# Copyright 2017 Google Inc. All Rights Reserved.
3+
# Copyright 2017 Google Inc.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)