├── .gitignore ├── datagen-core ├── build.gradle └── src │ └── main │ └── scala │ └── io │ └── lenses │ └── data │ └── generator │ └── stocks │ ├── StockGenerator.scala │ └── stocks.scala ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── datagen-jdbc ├── build.gradle └── src │ └── main │ └── scala │ └── com │ └── landoop │ └── data │ └── generator │ └── JdbcGenerator.scala ├── datagen-elastic ├── build.gradle └── src │ └── main │ └── scala │ └── com │ └── landoop │ └── data │ └── generator │ └── Elastic.scala ├── lenses.conf ├── datagen-kafka ├── src │ └── main │ │ ├── scala │ │ ├── io │ │ │ └── lenses │ │ │ │ └── data │ │ │ │ └── generator │ │ │ │ ├── FormatType.java │ │ │ │ ├── config │ │ │ │ ├── DataGeneratorConfig.scala │ │ │ │ └── ConfigExtension.scala │ │ │ │ ├── domain │ │ │ │ ├── recursive │ │ │ │ │ ├── Customer.scala │ │ │ │ │ └── CustomerGenerator.scala │ │ │ │ ├── iot │ │ │ │ │ ├── SensorData.scala │ │ │ │ │ ├── DeviceTemperature.scala │ │ │ │ │ ├── DeviceTemperatureDataGenerator.scala │ │ │ │ │ ├── SensorDataGenerator.scala │ │ │ │ │ └── DeviceTemperatureArrayDataGenerator.scala │ │ │ │ ├── Generator.scala │ │ │ │ ├── payments │ │ │ │ │ ├── Payment.scala │ │ │ │ │ ├── PaymentsGenerator.scala │ │ │ │ │ ├── CreditCard.scala │ │ │ │ │ └── CreditCardGenerator.scala │ │ │ │ ├── weather │ │ │ │ │ ├── Weather.scala │ │ │ │ │ └── WeatherDataGenerator.scala │ │ │ │ ├── bikesharing │ │ │ │ │ ├── Trips.scala │ │ │ │ │ ├── Station.scala │ │ │ │ │ ├── Trip.scala │ │ │ │ │ ├── StationsGenerator.scala │ │ │ │ │ └── TripsGenerator.scala │ │ │ │ ├── SubscriptionGenerator.scala │ │ │ │ └── DataGenerator.scala │ │ │ │ ├── Arguments.scala │ │ │ │ ├── CreateTopicFn.scala │ │ │ │ ├── json │ │ │ │ ├── JacksonXml.scala │ │ │ │ └── JacksonJson.scala │ │ │ │ ├── JdbcReader.scala │ │ │ │ ├── kafka │ │ │ │ └── Producers.scala │ │ │ │ └── Program.scala │ │ └── com │ │ │ └── landoop │ │ │ └── data │ │ │ └── generator │ │ │ └── FlightGenerator.scala │ │ ├── resources │ │ └── log4j.properties │ │ └── java │ │ └── io │ │ └── lenses │ │ └── data │ │ └── generator │ │ └── domain │ │ └── weather │ │ └── WeatherOuterClass.java └── build.gradle ├── settings.gradle ├── datagen-pulsar ├── build.gradle └── src │ └── main │ └── scala │ └── io │ └── lenses │ └── data │ └── generator │ ├── TickSchema.scala │ └── Pulsar.scala ├── datagen-jms ├── build.gradle └── src │ └── main │ └── scala │ └── com │ └── landoop │ └── data │ └── generator │ └── JmsGenerator.scala ├── datagen-hive ├── build.gradle └── src │ └── main │ ├── resources │ └── logback.xml │ └── scala │ └── io │ └── lenses │ └── datagen │ └── hive │ └── HiveGenerator.scala ├── .github └── workflows │ └── scala.yml ├── datagen-redis ├── build.gradle └── src │ └── main │ └── kotlin │ └── io │ └── lenses │ └── datagen │ └── redis │ ├── Redis.kt │ └── Tick.kt ├── proto └── weather.proto ├── readme.md ├── gradlew.bat └── gradlew /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .gradle 3 | *.iml 4 | out -------------------------------------------------------------------------------- /datagen-core/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile 'com.univocity:univocity-parsers:2.7.5' 3 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lensesio/datagen/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | version=1.0 2 | ossrhUsername=me 3 | ossrhPassword=you 4 | artifactory_user = "foo" 5 | artifactory_password = "foo" -------------------------------------------------------------------------------- /datagen-jdbc/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(":datagen-core") 3 | compile 'mysql:mysql-connector-java:8.0.13' 4 | } -------------------------------------------------------------------------------- /datagen-elastic/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(":datagen-core") 3 | compile 'com.sksamuel.elastic4s:elastic4s-http_2.12:6.4.0' 4 | } -------------------------------------------------------------------------------- /lenses.conf: -------------------------------------------------------------------------------- 1 | brokers="PLAINTEXT://cloudera01.landoop.com:19092,PLAINTEXT://cloudera02.landoop.com:19092" 2 | schema.registry="http://cloudera02.landoop.com:18081" 3 | format="avro" -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/FormatType.java: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator; 2 | 3 | public enum FormatType { 4 | AVRO, 5 | JSON, 6 | XML, 7 | PROTO 8 | } 9 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include 'datagen-core', 2 | 'datagen-kafka', 3 | 'datagen-hive', 4 | 'datagen-pulsar', 5 | 'datagen-elastic', 6 | // 'datagen-redis', 7 | 'datagen-jdbc', 8 | 'datagen-jms' -------------------------------------------------------------------------------- /datagen-pulsar/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(":datagen-core") 3 | compile "com.sksamuel.pulsar4s:pulsar4s-core_$scalaMajorVersion:2.1.0" 4 | compile "com.sksamuel.pulsar4s:pulsar4s-circe_$scalaMajorVersion:2.1.0" 5 | } -------------------------------------------------------------------------------- /datagen-jms/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(":datagen-core") 3 | compile 'com.sksamuel.elastic4s:elastic4s-http_2.12:6.4.0' 4 | compile 'org.apache.activemq:activemq-client:5.15.7' 5 | compile 'javax.jms:jms-api:1.1-rev-1' 6 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=debug, stdout 2 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 3 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 4 | log4j.appender.stdout.layout.ConversionPattern=[%t] %-5p %c %x - %m%n -------------------------------------------------------------------------------- /datagen-hive/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.RxHiveVersion = "0.20.166-SNAPSHOT" 3 | } 4 | 5 | repositories { 6 | maven { 7 | url "http://oss.sonatype.org/content/repositories/snapshots" 8 | } 9 | } 10 | 11 | dependencies { 12 | compile project(":datagen-core") 13 | compile "com.sksamuel.rxhive:rxhive-core:$RxHiveVersion" 14 | } -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/config/DataGeneratorConfig.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.config 2 | 3 | case class DataGeneratorConfig(brokers: String, 4 | schemaRegistry: String, 5 | pauseBetweenRecordsMs: Long, 6 | defaultSchemaRegistry: Boolean) 7 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/recursive/Customer.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain.recursive 2 | 3 | import com.sksamuel.avro4s.RecordFormat 4 | 5 | case class Customer(name: String, policyId: String, dependants: List[Customer]) 6 | 7 | object Customer { 8 | implicit val recordFormat: RecordFormat[Customer] = RecordFormat[Customer] 9 | } -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/iot/SensorData.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain.iot 2 | 3 | import com.sksamuel.avro4s.RecordFormat 4 | 5 | case class SensorData(id: String, temperature: Double, humidity: Double, timestamp: Long) 6 | 7 | object SensorData { 8 | implicit val recordFormat: RecordFormat[SensorData] = RecordFormat[SensorData] 9 | } -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/iot/DeviceTemperature.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain.iot 2 | 3 | import com.sksamuel.avro4s.RecordFormat 4 | 5 | case class DeviceTemperature(id: String, sensorType: String, values: List[Int]) 6 | 7 | object DeviceTemperature { 8 | implicit val recordFormat: RecordFormat[DeviceTemperature] = RecordFormat[DeviceTemperature] 9 | } -------------------------------------------------------------------------------- /.github/workflows/scala.yml: -------------------------------------------------------------------------------- 1 | name: Scala CI 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Set up JDK 1.8 17 | uses: actions/setup-java@v1 18 | with: 19 | java-version: 1.8 20 | - name: Run tests 21 | run: sbt test 22 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/Arguments.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator 2 | 3 | case class Arguments(topic: String, 4 | partitions: Int, 5 | replication: Int, 6 | dataSet: Int, 7 | format: FormatType, 8 | brokers: String, 9 | schemaRegistry: String, 10 | defaultSchemaRegistry: Boolean = true, 11 | produceDelay: Long = 1) -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/Generator.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain 2 | 3 | import io.lenses.data.generator.config.DataGeneratorConfig 4 | 5 | trait Generator { 6 | def avro(topic: String)(implicit config: DataGeneratorConfig): Unit 7 | 8 | def json(topic: String)(implicit config: DataGeneratorConfig): Unit 9 | 10 | def xml(topic: String)(implicit config: DataGeneratorConfig): Unit 11 | 12 | def protobuf(topic: String)(implicit config: DataGeneratorConfig): Unit 13 | } 14 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/payments/Payment.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain.payments 2 | 3 | import com.sksamuel.avro4s.RecordFormat 4 | 5 | case class Payment(id: String, 6 | time: String, 7 | amount: BigDecimal, 8 | currency: String, 9 | creditCardId: String, 10 | merchantId: Long) 11 | 12 | object Payment { 13 | implicit val recordFormat: RecordFormat[Payment] = RecordFormat[Payment] 14 | } 15 | -------------------------------------------------------------------------------- /datagen-redis/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.20' 3 | repositories { 4 | mavenCentral() 5 | } 6 | dependencies { 7 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 8 | } 9 | } 10 | 11 | apply plugin: 'kotlin' 12 | apply plugin: 'java' 13 | 14 | dependencies { 15 | implementation 'com.univocity:univocity-parsers:2.7.5' 16 | implementation "org.jetbrains.kotlin:kotlin-stdlib" 17 | implementation 'com.xenomachina:kotlin-argparser:2.0.7' 18 | implementation 'redis.clients:jedis:3.0.0-SAM' 19 | } -------------------------------------------------------------------------------- /proto/weather.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | message Wind { 4 | int32 chill = 1; 5 | int32 direction = 2; 6 | int32 speed = 3; 7 | }; 8 | 9 | message Atmosphere { 10 | int32 humidity = 1; 11 | double pressure = 2; 12 | int32 rising = 3; 13 | double visibility = 4; 14 | }; 15 | 16 | message Forecast { 17 | string date = 1; 18 | string day = 2; 19 | int32 high = 3; 20 | int32 low = 4; 21 | string text = 5; 22 | } 23 | 24 | message Weather { 25 | Wind wind = 1; 26 | Atmosphere atmosphere = 2; 27 | repeated Forecast forecast = 3; 28 | }; -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/weather/Weather.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain.weather 2 | 3 | import com.sksamuel.avro4s.RecordFormat 4 | 5 | case class WindS(chill: Int, direction: Int, speed: Int) 6 | 7 | case class AtmosphereS(humidity: Int, pressure: Double, rising: Int, visibility: Double) 8 | 9 | case class ForecastS(date: String, day: String, high: Int, low: Int, text: String) 10 | 11 | case class WeatherS(wind: WindS, atmosphere: AtmosphereS, forecasts: List[ForecastS]) 12 | 13 | object WeatherS { 14 | implicit val recordFormat: RecordFormat[WeatherS] = RecordFormat[WeatherS] 15 | } -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/bikesharing/Trips.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain.bikesharing 2 | 3 | import org.joda.time.DateTime 4 | 5 | case class Trips( 6 | id: Int, 7 | duration: Int, 8 | start_date: DateTime, 9 | start_station: Int, 10 | end_date: DateTime, 11 | end_station: Int, 12 | bike_number: String, 13 | sub_type: String, 14 | zip_code: String, 15 | birth_date: Int, 16 | gender: String 17 | ) -------------------------------------------------------------------------------- /datagen-hive/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /datagen-core/src/main/scala/io/lenses/data/generator/stocks/StockGenerator.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.stocks 2 | 3 | import scala.util.Random 4 | 5 | object StockGenerator { 6 | def generateTick: Tick = { 7 | val stock = Stock.stocks(Random.nextInt(Stock.stocks.length)) 8 | val price = Random.nextDouble() * 1000 9 | val spread = price / Random.nextDouble() 10 | val bid = price - spread 11 | val ask = price + spread 12 | Tick( 13 | stock.symbol, 14 | stock.name, 15 | Random.shuffle(List("N", "Q")).head, 16 | bid, 17 | ask, 18 | stock.etf, 19 | Random.nextInt(100) * 100, 20 | stock.exchange 21 | ) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/iot/DeviceTemperatureDataGenerator.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain.iot 2 | 3 | import io.lenses.data.generator.domain.DataGenerator 4 | 5 | import scala.util.Random 6 | 7 | object DeviceTemperatureDataGenerator extends DataGenerator[DeviceTemperature] { 8 | private val devices = (1 to 100).map { i => s"cD$i" }.toVector 9 | 10 | override protected def generate(): Seq[(String, DeviceTemperature)] = { 11 | devices.map { d => 12 | val device = DeviceTemperature( 13 | d, 14 | "Temperature", 15 | List(Random.nextInt(), Random.nextInt(), Random.nextInt(), Random.nextInt())) 16 | d -> device 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/recursive/CustomerGenerator.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain.recursive 2 | 3 | import io.lenses.data.generator.domain.DataGenerator 4 | 5 | object CustomerGenerator extends DataGenerator[Customer] { 6 | override protected def generate(): Seq[(String, Customer)] = { 7 | List( 8 | "Jackie Chan" -> Customer("Jackie Chan", "123A", Nil), 9 | "Gica Petrescu" -> Customer("Gica Petrescu", "35436B", List( 10 | Customer("Ana Petrescu", "35436B", Nil) 11 | )), 12 | "Andri Popa" -> Customer("Andri Popa", "123t122", List( 13 | Customer("Leana Popa", "123t122", Nil), 14 | Customer("Micul Andri Popa", "123t122", Nil) 15 | )) 16 | ) 17 | } 18 | } -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/bikesharing/Station.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain.bikesharing 2 | 3 | import io.lenses.data.generator.JdbcReader 4 | 5 | case class Station(id: Int, 6 | station: String, 7 | municipality: String, 8 | lat: Double, 9 | lng: Double) 10 | 11 | object Station { 12 | def fromDb(): Iterable[Station] = { 13 | val dbPath = getClass.getResource("/hubway.db").toURI.getPath 14 | new JdbcReader(s"jdbc:sqlite:$dbPath") 15 | .read("SELECT * FROM stations"){rs=> 16 | Station( 17 | rs.getInt("id"), 18 | rs.getString("station"), 19 | rs.getString("municipality"), 20 | rs.getString("lat").toDouble, 21 | rs.getString("lng").toDouble 22 | ) 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/iot/SensorDataGenerator.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain.iot 2 | 3 | import io.lenses.data.generator.domain.DataGenerator 4 | 5 | import scala.util.Random 6 | 7 | object SensorDataGenerator extends DataGenerator[SensorData] { 8 | val sensorIds = Array("SB01", "SB02", "SB03", "SB04") 9 | val dataMap: Map[String, SensorData] = sensorIds.map { it => 10 | val sensor = SensorData(it, 23.0, 38.0, System.currentTimeMillis()) 11 | (it, sensor) 12 | }.toMap 13 | 14 | override protected def generate(): Seq[(String, SensorData)] = { 15 | sensorIds.map { sensorId => 16 | val prev = dataMap(sensorId) 17 | sensorId -> SensorData(sensorId, 18 | prev.temperature + Random.nextDouble() * 2 + Random.nextInt(2), 19 | prev.humidity + Random.nextDouble() * 2 * (if (Random.nextInt(2) % 2 == 0) -1 else 1), 20 | System.currentTimeMillis()) 21 | } 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | Building 2 | -------- 3 | 4 | ```bash 5 | gradle clean build 6 | ``` 7 | 8 | This will produce an tar/zip in build/distribution folder. 9 | The archive contains a default `lenses.conf` to pass as first argument to the application. 10 | 11 | 12 | Running 13 | ------- 14 | 15 | ```bash 16 | bin/generator see below 17 | 18 | ``` 19 | 20 | 21 | Options 22 | ------- 23 | ```json 24 | 25 | --data 5 --topic iot_device_temperature_avro --format AVRO --brokers PLAINTEXT://broker --schema http://machine:18081 26 | 27 | --data 5 --topic iot_device_temperature_xml --format XML --brokers PLAINTEXT://brokers --schema http://machine:18081 28 | 29 | --data 5 --topic iot_device_temperature_json --format JSON --brokers PLAINTEXT://broker --schema http://machine:18081 30 | 31 | ``` 32 | 33 | Available formats: JSON, XML, AVRO, PROTO 34 | Available --data options: 35 | 36 | 1 -> CreditCardGenerator, 37 | 2 -> PaymentsGenerator, 38 | 3 -> SensorDataGenerator, 39 | 4 -> WeatherDataGenerator, 40 | 5 -> DeviceTemperatureDataGenerator, 41 | 6 -> DeviceTemperatureArrayDataGenerator 42 | 43 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/CreateTopicFn.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator 2 | 3 | import java.util.{Collections, Properties} 4 | 5 | import org.apache.kafka.clients.CommonClientConfigs 6 | import org.apache.kafka.clients.admin.{AdminClient, NewTopic} 7 | 8 | import scala.util.Try 9 | 10 | object CreateTopicFn { 11 | def apply(topic: String, 12 | partitions: Int, 13 | replication: Int)(implicit arguments: Arguments): Try[Unit] = { 14 | Try { 15 | createAdminClient() 16 | }.map { implicit adminClient => 17 | try { 18 | val topics = adminClient.listTopics().names().get() 19 | if (!topics.contains(topic)) { 20 | adminClient.createTopics(Collections.singleton(new NewTopic(topic, partitions, replication.toShort))) 21 | .all().get() 22 | } 23 | } finally { 24 | adminClient.close() 25 | } 26 | } 27 | } 28 | 29 | def createAdminClient()(implicit arguments: Arguments): AdminClient = { 30 | val props = new Properties() 31 | props.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, arguments.brokers) 32 | AdminClient.create(props) 33 | } 34 | } -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/json/JacksonXml.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.json 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude.Include 4 | import com.fasterxml.jackson.databind.{DeserializationFeature, JsonNode} 5 | import com.fasterxml.jackson.dataformat.xml.XmlMapper 6 | import com.fasterxml.jackson.module.scala.DefaultScalaModule 7 | import com.fasterxml.jackson.module.scala.experimental.ScalaObjectMapper 8 | 9 | import scala.reflect.ClassTag 10 | 11 | private[lenses] object JacksonXml { 12 | val Mapper: XmlMapper with ScalaObjectMapper = { 13 | val m = new XmlMapper() with ScalaObjectMapper 14 | m.registerModule(DefaultScalaModule) 15 | m.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) 16 | m.setSerializationInclusion(Include.NON_NULL) 17 | m.setSerializationInclusion(Include.NON_EMPTY) 18 | //m.setDefaultUseWrapper(true) 19 | m 20 | } 21 | 22 | def toXml[T](value: T): String = Mapper.writeValueAsString(value) 23 | 24 | 25 | def asXml[T](value: T): JsonNode = Mapper.valueToTree(value) 26 | 27 | 28 | def fromXml[T](json: String)(implicit ct: ClassTag[T]): T = Mapper.readValue(json, ct.runtimeClass).asInstanceOf[T] 29 | 30 | 31 | } -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/json/JacksonJson.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.json 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude.Include 4 | import com.fasterxml.jackson.databind.{DeserializationFeature, JsonNode, ObjectMapper} 5 | import com.fasterxml.jackson.module.scala.DefaultScalaModule 6 | import com.fasterxml.jackson.module.scala.experimental.ScalaObjectMapper 7 | 8 | import scala.reflect.ClassTag 9 | 10 | private[lenses] object JacksonJson { 11 | val Mapper: ObjectMapper = { 12 | val m = new ObjectMapper() with ScalaObjectMapper 13 | m.registerModule(DefaultScalaModule) 14 | m.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) 15 | m.setSerializationInclusion(Include.NON_NULL) 16 | m.setSerializationInclusion(Include.NON_EMPTY) 17 | m 18 | } 19 | 20 | def toJson[T](value: T): String = Mapper.writeValueAsString(value) 21 | 22 | 23 | def asJson[T](value: T): JsonNode = Mapper.valueToTree(value) 24 | 25 | 26 | def fromJson[T](json: String)(implicit ct: ClassTag[T]): T = Mapper.readValue(json, ct.runtimeClass).asInstanceOf[T] 27 | 28 | 29 | def toMap[V](json: String)(implicit m: Manifest[V]): Map[String, V] = fromJson[Map[String, V]](json) 30 | 31 | } 32 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/payments/PaymentsGenerator.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain.payments 2 | 3 | import io.lenses.data.generator.domain.DataGenerator 4 | import org.joda.time.format.ISODateTimeFormat 5 | import org.joda.time.{DateTime, DateTimeZone} 6 | 7 | import scala.math.BigDecimal.RoundingMode 8 | import scala.util.Random 9 | import DataGenerator._ 10 | object PaymentsGenerator extends DataGenerator[Payment] { 11 | 12 | private val MerchantIds = (1 to 100).map(_.toLong).toVector 13 | private val DateFormatter = ISODateTimeFormat.dateTime() 14 | 15 | override protected def generate(): Seq[(String, Payment)] = { 16 | val index = Random.nextInt(CreditCard.Cards.size) 17 | val cc = CreditCard.Cards(index) 18 | 19 | val dt = new DateTime().toDateTime(DateTimeZone.UTC) 20 | val date = DateFormatter.print(dt) 21 | 22 | val left = 10 + Random.nextInt(5000) 23 | val right = Random.nextInt(100) 24 | val decimal = BigDecimal(s"$left.$right").setScale(18, RoundingMode.HALF_UP) 25 | val id = s"txn${System.currentTimeMillis()}" 26 | List( 27 | id -> Payment(id, date, decimal, cc.currency, cc.number, MerchantIds(Random.nextInt(MerchantIds.size))) 28 | ) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/JdbcReader.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator 2 | 3 | import java.sql.DriverManager 4 | import java.sql.ResultSet 5 | 6 | import scala.util.Failure 7 | import scala.util.Success 8 | import scala.util.Try 9 | 10 | class JdbcReader(connection: String) extends AutoCloseable { 11 | 12 | if (connection == null || connection.trim.isEmpty) { 13 | throw new IllegalArgumentException("Invalid connection string provided for the store.") 14 | } 15 | 16 | private val dbConnection = Try { 17 | DriverManager.getConnection(connection) 18 | } match { 19 | case Success(value) => value 20 | case Failure(exception) => throw new IllegalArgumentException(s"Invalid connection provided.[$connection] can not be opened.", exception) 21 | } 22 | 23 | override def close(): Unit = { 24 | dbConnection.close() 25 | } 26 | 27 | def read[T](sql: String)(fn: ResultSet => T): Iterable[T] = { 28 | val statement = dbConnection.createStatement() 29 | 30 | val resultSet = statement.executeQuery(sql) 31 | new Iterable[T] { 32 | override def iterator: Iterator[T] = new Iterator[T] { 33 | override def hasNext: Boolean = { 34 | val next = resultSet.next() 35 | if (!next) { 36 | Try(resultSet.close()) 37 | Try(statement.close()) 38 | } 39 | next 40 | } 41 | override def next(): T = fn(resultSet) 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /datagen-redis/src/main/kotlin/io/lenses/datagen/redis/Redis.kt: -------------------------------------------------------------------------------- 1 | package io.lenses.datagen.redis 2 | 3 | import com.xenomachina.argparser.ArgParser 4 | import com.xenomachina.argparser.mainBody 5 | import redis.clients.jedis.Jedis 6 | import redis.clients.jedis.StreamEntryID 7 | 8 | class RedisConfig(parser: ArgParser) { 9 | 10 | val host by parser.storing( 11 | "--host", 12 | help = "Hostname of the redis server") 13 | 14 | val port by parser.storing( 15 | "--port", 16 | help = "Port of the redis server") { toInt() } 17 | 18 | val key by parser.storing( 19 | "--key", 20 | help = "Key name used to insert streaming data") 21 | 22 | val count by parser.storing( 23 | "--count", 24 | help = "Number of sample records to insert") { toInt() } 25 | } 26 | 27 | fun main(args: Array): Unit = mainBody { 28 | 29 | println( 30 | """ 31 | | 32 | | _ 33 | | | | ___ _ __ ___ ___ ___ 34 | | | | / _ \ '_ \/ __|/ _ \/ __| 35 | | | |__| __/ | | \__ \ __/\__ \ 36 | | |_____\___|_|_|_|___/\___||___/ _ 37 | | | _ \ __ _| |_ __ _ / ___| ___ _ __ ___ _ __ __ _| |_ ___ _ __ 38 | | | | | |/ _` | __/ _` | | | _ / _ \ '_ \ / _ \ '__/ _` | __/ _ \| '__| 39 | | | |_| | (_| | || (_| | | |_| | __/ | | | __/ | | (_| | || (_) | | 40 | | |____/ \__,_|\__\__,_| \____|\___|_| |_|\___|_| \__,_|\__\___/|_| 41 | | 42 | """) 43 | 44 | ArgParser(args).parseInto(::RedisConfig).run { 45 | println("Generating $count records") 46 | val jedis = Jedis(host, port) 47 | repeat(count) { 48 | jedis.xadd(key, StreamEntryID.NEW_ENTRY, Tick.gen().toMap()) 49 | } 50 | jedis.close() 51 | } 52 | 53 | } 54 | 55 | 56 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/config/ConfigExtension.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.config 2 | 3 | import com.typesafe.config.Config 4 | import scala.collection.JavaConversions._ 5 | 6 | object ConfigExtension { 7 | 8 | implicit class Extractor(val config: Config) extends AnyVal { 9 | def readInt(key: String, default: Int): Int = get(key, default)(config.getInt) 10 | 11 | def readInt(key: String): Int = get(key)(config.getInt) 12 | 13 | def readLong(key: String, default: Long): Long = get(key, default)(config.getLong) 14 | 15 | def readLong(key: String): Long = get(key)(config.getLong) 16 | 17 | def readString(key: String, default: String): String = get(key, default)(config.getString) 18 | 19 | def readString(key: String): String = get(key)(config.getString) 20 | 21 | def readStringList(key: String): List[String] = get(key)(config.getStringList).toList 22 | 23 | def readStringList(key: String, default: List[String]): List[String] = get(key, default)(k => config.getStringList(k).toList) 24 | 25 | def readBoolean(key: String, default: Boolean): Boolean = get(key, default)(config.getBoolean) 26 | 27 | def readBoolean(key: String): Boolean = get(key)(config.getBoolean) 28 | 29 | def readDouble(key: String, default: Double): Double = get(key, default)(config.getDouble) 30 | 31 | def readDouble(key: String): Double = get(key)(config.getDouble) 32 | 33 | private def get[T](key: String, default: T)(extractor: (String) => T) = { 34 | if (config.hasPath(key)) extractor(key) 35 | else default 36 | } 37 | 38 | private def get[T](key: String)(extractor: (String) => T) = { 39 | if (config.hasPath(key)) extractor(key) 40 | else throw new IllegalArgumentException(s"Missing configuration entry for '$key'") 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /datagen-core/src/main/scala/io/lenses/data/generator/stocks/stocks.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.stocks 2 | 3 | import com.univocity.parsers.csv.{CsvParser, CsvParserSettings} 4 | 5 | import scala.collection.JavaConverters._ 6 | 7 | case class Exchange(name: String, symbol: String) { 8 | require(name != null) 9 | require(symbol != null) 10 | } 11 | 12 | object Exchange { 13 | def forSymbol(symbol: String): Exchange = { 14 | val name = symbol match { 15 | case "A" => "NYSE MKT" 16 | case "N" => "New York Stock Exchange (NYSE)" 17 | case "P" => "NYSE ARCA" 18 | case "Z" => "BATS Global Markets (BATS)" 19 | case "V" => "Investors' Exchange, LLC (IEXG)" 20 | case _ => "Nasdaq" 21 | } 22 | Exchange(name, symbol) 23 | } 24 | } 25 | 26 | case class Stock(symbol: String, name: String, etf: Boolean, exchange: Exchange, lotSize: Int) { 27 | require(symbol != null) 28 | require(name != null) 29 | require(exchange != null) 30 | } 31 | 32 | object Stock { 33 | 34 | lazy val stocks: Array[Stock] = { 35 | 36 | val settings: CsvParserSettings = new CsvParserSettings 37 | settings.getFormat.setLineSeparator("\n") 38 | settings.getFormat.setDelimiter('|') 39 | settings.setHeaderExtractionEnabled(true) 40 | 41 | val parser: CsvParser = new CsvParser(settings) 42 | parser.parseAllRecords(getClass.getResourceAsStream("/otherlisted.txt")).asScala 43 | .map { record => 44 | Stock( 45 | record.getString("NASDAQ Symbol"), 46 | record.getString("Security Name"), 47 | record.getString("ETF") == "Y", 48 | Exchange.forSymbol(record.getString("Exchange")), 49 | record.getInt("Round Lot Size") 50 | ) 51 | } 52 | }.toArray 53 | } 54 | 55 | case class Tick(symbol: String, name: String, category: String, bid: Double, ask: Double, etf: Boolean, lotSize: Int, exchange: Exchange) -------------------------------------------------------------------------------- /datagen-pulsar/src/main/scala/io/lenses/data/generator/TickSchema.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator 2 | 3 | import java.nio.charset.StandardCharsets 4 | import java.util.Collections 5 | 6 | import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder} 7 | import io.circe.{Decoder, Encoder, Printer} 8 | import io.lenses.data.generator.stocks.Exchange 9 | import io.lenses.data.generator.stocks.Tick 10 | import io.lenses.data.generator.stocks.Tick 11 | import org.apache.pulsar.client.api.Schema 12 | import org.apache.pulsar.common.schema.{SchemaInfo, SchemaType} 13 | import org.apache.pulsar.shade.org.apache.avro.SchemaBuilder 14 | 15 | object TickSchema extends Schema[Tick] { 16 | 17 | val info = new SchemaInfo() 18 | info.setName("") 19 | info.setProperties(Collections.emptyMap()) 20 | info.setType(SchemaType.JSON) 21 | info.setSchema( 22 | SchemaBuilder.record("tick").fields() 23 | .requiredString("symbol") 24 | .requiredString("name") 25 | .requiredString("category") 26 | .requiredDouble("bid") 27 | .requiredDouble("ask") 28 | .requiredBoolean("etf") 29 | .requiredInt("lotSize") 30 | .name("exchange").`type`(SchemaBuilder.record("exchange").fields().requiredString("name").requiredString("symbol").endRecord()).noDefault() 31 | .endRecord().toString().getBytes("UTF8")) 32 | 33 | implicit val encoderExchange: Encoder[Exchange] = deriveEncoder[Exchange] 34 | implicit val decoderExchange: Decoder[Exchange] = deriveDecoder[Exchange] 35 | implicit val encoder: Encoder[Tick] = deriveEncoder[Tick] 36 | implicit val decoder: Decoder[Tick] = deriveDecoder[Tick] 37 | 38 | override def encode(t: Tick): Array[Byte] = Printer.spaces2.pretty(encoder(t)).getBytes 39 | override def decode(bytes: Array[Byte]): Tick = io.circe.jawn.decode[Tick](new String(bytes, StandardCharsets.UTF_8)).right.get 40 | override def getSchemaInfo: SchemaInfo = info 41 | } 42 | -------------------------------------------------------------------------------- /datagen-kafka/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | scalaMajorVersion = '2.12' 4 | jacksonVersion = '2.9.6' 5 | kafkaVersion = '2.2.0' 6 | avro4sVersion = "2.0.4" 7 | confluentVersion = "3.3.0" 8 | sqlLiteVersion = "3.27.2.1" 9 | } 10 | } 11 | 12 | plugins { 13 | id "com.google.protobuf" version "0.8.11" 14 | } 15 | 16 | dependencies { 17 | compile project(":datagen-core") 18 | compile "org.apache.kafka:kafka-clients:$kafkaVersion" 19 | compile "io.confluent:kafka-avro-serializer:$confluentVersion" 20 | compile "beyondthelines:pbdirect_$scalaMajorVersion:0.1.0" 21 | compile "io.protoless:protoless-core_$scalaMajorVersion:0.0.7" 22 | compile "io.protoless:protoless-generic_$scalaMajorVersion:0.0.7" 23 | compile 'com.google.protobuf:protobuf-java:3.0.0' 24 | compile "com.sksamuel.avro4s:avro4s-core_$scalaMajorVersion:$avro4sVersion" 25 | 26 | compile "io.kotlintest:kotlintest-datagen:0.10.0" 27 | 28 | compile "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion" 29 | compile "com.fasterxml.jackson.module:jackson-module-scala_$scalaMajorVersion:$jacksonVersion" 30 | compile "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jacksonVersion" 31 | 32 | compile "org.xerial:sqlite-jdbc:$sqlLiteVersion" 33 | 34 | } 35 | 36 | repositories { 37 | maven { url "http://packages.confluent.io/maven/" } 38 | maven { url "https://dl.bintray.com/beyondthelines/maven/" } 39 | maven { url "https://dl.bintray.com/julien-lafont/maven/" } 40 | } 41 | 42 | sourceSets { 43 | main { 44 | proto { 45 | // In addition to the default 'src/main/proto' 46 | srcDir 'proto/' 47 | } 48 | 49 | } 50 | } 51 | 52 | protobuf { 53 | 54 | // Configure the protoc executable 55 | protoc { 56 | // Download from repositories 57 | artifact = 'com.google.protobuf:protoc:3.5.1' 58 | } 59 | } -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/payments/CreditCard.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain.payments 2 | 3 | case class CreditCard(number: String, 4 | customerFirstName: String, 5 | customerLastName: String, 6 | country: String, 7 | currency: String, 8 | blocked: Boolean) 9 | 10 | object CreditCard { 11 | val Cards = Vector( 12 | CreditCard("5162258362252394", "April", "Paschall", "GBR", "GBP", false), 13 | CreditCard("5290441401157247", "Charisse", "Daggett", "USA", "USD", false), 14 | CreditCard("5397076989446422", "Gibson", "Chunn", "USA", "USD", true), 15 | CreditCard("5248189647994492", "Hector", "Swinson", "NOR", "NOR", false), 16 | CreditCard("5196864976665762", "Booth", "Spiess", "CNA", "CAD", false), 17 | CreditCard("5423023313257503", "Hitendra", "Sibert", "CHE", "CHF", false), 18 | CreditCard("5337899393425317", "Larson", "Asbell", "SWE", "SEK", false), 19 | CreditCard("5140590381876333", "Zechariah", "Schwarz", "GER", "EUR", false), 20 | CreditCard("5524874546065610", "Shulamith", "Earles", "FRA", "EUR", true), 21 | CreditCard("5204216758311612", "Tangwyn", "Gorden", "GBR", "GBP", false), 22 | CreditCard("5336077954566768", "Miguel", "Gonzales", "ESP", "EUR", true), 23 | CreditCard("5125835811760048", "Randie", "Ritz", "NOR", "CAD", true), 24 | CreditCard("5317812241111538", "Michelle", "Fleur", "FRA", "EUR", true), 25 | CreditCard("5373595752176476", "Thurborn", "Asbell", "GBR", "GBP", true), 26 | CreditCard("5589753170506689", "Noni", "Gorden", "AUT", "EUR", true), 27 | CreditCard("5588152341005179", "Vivian", "Glowacki", "POL", "EUR", false), 28 | CreditCard("5390713494347532", "Elward", "Frady", "USA", "USD", true), 29 | CreditCard("5322449980897580", "Severina", "Bracken", "AUT", "EUR", false), 30 | CreditCard("5280153815233678", "Kara", "Moretti", "ITA", "EUR", false), 31 | CreditCard("5574906917600002", "Menaka", "Harsh", "GER", "EUR", false) 32 | ) 33 | } 34 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/bikesharing/Trip.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain.bikesharing 2 | 3 | import java.time.LocalDateTime 4 | import java.time.chrono.IsoChronology 5 | import java.time.format.DateTimeFormatter 6 | import java.util.Locale 7 | 8 | import io.lenses.data.generator.JdbcReader 9 | 10 | case class Trip(id: Int, 11 | duration: Long, 12 | start_date: LocalDateTime, 13 | start_station: Int, 14 | end_date: LocalDateTime, 15 | end_station: Int, 16 | bike_number: String, 17 | sub_type: String, 18 | zip_code: Option[String], 19 | birth_date: Option[Int], 20 | gender: Option[String]) 21 | 22 | object Trip { 23 | def fromDb(): Iterable[Trip] = { 24 | val dbPath = getClass.getResource("/hubway.db").toURI.getPath 25 | 26 | val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss") 27 | .withLocale(Locale.ROOT) 28 | .withChronology(IsoChronology.INSTANCE) 29 | 30 | new JdbcReader(s"jdbc:sqlite:$dbPath") 31 | .read("SELECT * FROM trips") { rs => 32 | var zipCode = rs.getString("zip_code") 33 | if (zipCode.startsWith("'")) { 34 | zipCode = zipCode.drop(1) 35 | } 36 | Trip( 37 | rs.getInt("id"), 38 | rs.getInt("duration"), 39 | LocalDateTime.parse(rs.getString("start_date"), formatter), 40 | rs.getInt("start_station"), 41 | LocalDateTime.parse(rs.getString("end_date"), formatter), 42 | rs.getInt("end_station"), 43 | rs.getString("bike_number"), 44 | rs.getString("sub_type"), 45 | ifEmptyNone(zipCode), 46 | ifZeroNone(rs.getDouble("birth_date").toInt), 47 | ifEmptyNone(rs.getString("gender")) 48 | ) 49 | } 50 | } 51 | private def ifEmptyNone(s: String): Option[String] = if (s.isEmpty) None else Some(s) 52 | private def ifZeroNone(i: Int): Option[Int] = if (i <= 0) None else Some(i) 53 | } 54 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/kafka/Producers.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.kafka 2 | 3 | import java.util.Properties 4 | 5 | import io.lenses.data.generator.config.DataGeneratorConfig 6 | import io.confluent.kafka.serializers.{AbstractKafkaAvroSerDeConfig, KafkaAvroSerializer} 7 | import io.lenses.data.generator.config.DataGeneratorConfig 8 | import org.apache.kafka.clients.producer.ProducerConfig 9 | import org.apache.kafka.common.serialization.{Serializer, StringSerializer} 10 | 11 | object Producers { 12 | def getAvroValueProducerProps[T <: Serializer[_]](ser: Class[T])(implicit config: DataGeneratorConfig): Properties = { 13 | val props = new Properties 14 | props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, ser) 15 | props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, classOf[KafkaAvroSerializer]) 16 | props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, config.brokers) 17 | props.put(AbstractKafkaAvroSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG, config.schemaRegistry) 18 | props 19 | } 20 | 21 | def getStringValueProducerProps[T <: Serializer[_]](ser: Class[T])(implicit config: DataGeneratorConfig): Properties = { 22 | val props = new Properties 23 | props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, ser) 24 | props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, classOf[StringSerializer]) 25 | props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, config.brokers) 26 | props.put(AbstractKafkaAvroSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG, config.schemaRegistry) 27 | props 28 | } 29 | 30 | def getProducerProps[K <: Serializer[_], V <: Serializer[_]](keySer: Class[K], valueSer:Class[V])(implicit config: DataGeneratorConfig): Properties = { 31 | val props = new Properties 32 | props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, keySer) 33 | props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, valueSer) 34 | props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, config.brokers) 35 | props.put(AbstractKafkaAvroSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG, config.schemaRegistry) 36 | props 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/com/landoop/data/generator/FlightGenerator.scala: -------------------------------------------------------------------------------- 1 | package com.landoop.data.generator 2 | 3 | import java.time.{Instant, ZoneOffset} 4 | 5 | import io.kotlintest.datagen.AirportProducer 6 | import io.lenses.data.generator.config.DataGeneratorConfig 7 | import io.lenses.data.generator.kafka.Producers 8 | import org.apache.avro.{LogicalTypes, SchemaBuilder} 9 | import org.apache.avro.generic.GenericData 10 | import org.apache.kafka.clients.producer.{KafkaProducer, ProducerRecord} 11 | import org.apache.kafka.common.serialization.StringSerializer 12 | 13 | object FlightGenerator extends App { 14 | 15 | val config = DataGeneratorConfig("localhost:9092", "http://localhost:8081", 1, true) 16 | val props = Producers.getAvroValueProducerProps(classOf[StringSerializer])(config) 17 | implicit val producer: KafkaProducer[String, Any] = new KafkaProducer[String, Any](props) 18 | 19 | val startTime = Instant.now().atOffset(ZoneOffset.UTC).minusYears(1) 20 | 21 | val time = SchemaBuilder.builder().longType() 22 | LogicalTypes.timestampMillis().addToSchema(time) 23 | val schema = SchemaBuilder.record("flight").fields() 24 | //.name("departure_time").`type`(time).noDefault() 25 | .requiredLong("departure_time") 26 | .requiredString("departure_airport") 27 | .requiredString("departure_airport_code") 28 | .requiredString("arrival_airport") 29 | .requiredString("arrival_airport_code") 30 | .endRecord() 31 | 32 | for (k <- 1 to 5000000) { 33 | val departure = AirportProducer.INSTANCE.produce() 34 | val arrival = AirportProducer.INSTANCE.produce() 35 | val record = new GenericData.Record(schema) 36 | record.put("departure_time", startTime.plusMinutes(k).toInstant.toEpochMilli) 37 | record.put("departure_airport", departure.getName) 38 | record.put("departure_airport_code", departure.getCode) 39 | record.put("arrival_airport", arrival.getName) 40 | record.put("arrival_airport_code", arrival.getCode) 41 | val precord = new ProducerRecord[String, Any]("flights4", record) 42 | producer.send(precord) 43 | } 44 | 45 | producer.close() 46 | println("Completed") 47 | } 48 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /datagen-jdbc/src/main/scala/com/landoop/data/generator/JdbcGenerator.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator 2 | 3 | import java.sql.DriverManager 4 | 5 | import com.typesafe.scalalogging.StrictLogging 6 | import io.lenses.data.generator.stocks.StockGenerator 7 | import scopt.OptionParser 8 | 9 | object JdbcGenerator extends App with StrictLogging { 10 | 11 | case class JdbcConfig(url: String, count: Int) 12 | 13 | logger.info( 14 | """ 15 | | 16 | | _ 17 | | | | ___ _ __ ___ ___ ___ 18 | | | | / _ \ '_ \/ __|/ _ \/ __| 19 | | | |__| __/ | | \__ \ __/\__ \ 20 | | |_____\___|_|_|_|___/\___||___/ _ 21 | | | _ \ __ _| |_ __ _ / ___| ___ _ __ ___ _ __ __ _| |_ ___ _ __ 22 | | | | | |/ _` | __/ _` | | | _ / _ \ '_ \ / _ \ '__/ _` | __/ _ \| '__| 23 | | | |_| | (_| | || (_| | | |_| | __/ | | | __/ | | (_| | || (_) | | 24 | | |____/ \__,_|\__\__,_| \____|\___|_| |_|\___|_| \__,_|\__\___/|_| 25 | | 26 | """.stripMargin) 27 | 28 | val parser: OptionParser[JdbcConfig] = new scopt.OptionParser[JdbcConfig]("generator") { 29 | head("generator") 30 | 31 | opt[String]("url").required().action { case (url, a) => 32 | a.copy(url = url) 33 | }.validate(f => if (f.trim.isEmpty) Left("Invalid url") else Right(())) 34 | .text("url") 35 | 36 | opt[Int]("count").optional().action { case (count, a) => 37 | a.copy(count = count) 38 | }.validate(f => Right(f)) 39 | .text("count") 40 | } 41 | 42 | parser.parse(args, JdbcConfig("", 1000)).foreach { config => 43 | 44 | val conn = DriverManager.getConnection(config.url) 45 | conn.createStatement().execute("CREATE TABLE IF NOT EXISTS stockticks (category varchar(10), etf bool, symbol varchar(8), name varchar(255), bid double, ask double, lotsize smallint)") 46 | 47 | val stmt = conn.prepareStatement("INSERT INTO stockticks (category, etf, symbol, name, bid, ask, lotsize) VALUES (?,?,?,?,?,?,?)") 48 | for (k <- 1 to config.count) { 49 | val tick = StockGenerator.generateTick 50 | stmt.setString(1, tick.category) 51 | stmt.setBoolean(2, tick.etf) 52 | stmt.setString(3, tick.symbol) 53 | stmt.setString(4, tick.name) 54 | stmt.setDouble(5, tick.bid) 55 | stmt.setDouble(6, tick.ask) 56 | stmt.setInt(7, tick.lotSize) 57 | stmt.addBatch() 58 | if (k % 1000 == 0) { 59 | stmt.executeBatch() 60 | stmt.clearBatch() 61 | println(s"Completed $k messsages") 62 | } 63 | } 64 | 65 | if (config.count % 1000 > 0) { 66 | stmt.executeBatch() 67 | } 68 | 69 | stmt.executeBatch() 70 | conn.close() 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /datagen-redis/src/main/kotlin/io/lenses/datagen/redis/Tick.kt: -------------------------------------------------------------------------------- 1 | package io.lenses.datagen.redis 2 | 3 | import com.univocity.parsers.csv.CsvParser 4 | import com.univocity.parsers.csv.CsvParserSettings 5 | import java.util.* 6 | 7 | data class Stock(val symbol: String, val name: String, val etf: Boolean, val exchange: Exchange, val lotSize: Int) { 8 | companion object { 9 | 10 | val stocks: Array = CsvParserSettings().run { 11 | format.setLineSeparator("\n") 12 | format.delimiter = '|' 13 | isHeaderExtractionEnabled = true 14 | 15 | val parser = CsvParser(this) 16 | parser.parseAllRecords(this::class.java.getResourceAsStream("/otherlisted.txt")).map { 17 | Stock( 18 | it.getString("NASDAQ Symbol"), 19 | it.getString("Security Name"), 20 | it.getString("ETF") == "Y", 21 | Exchange.forSymbol(it.getString("Exchange")), 22 | it.getInt("Round Lot Size") 23 | ) 24 | }.toTypedArray() 25 | } 26 | } 27 | } 28 | 29 | data class Exchange(val name: String, val symbol: String) { 30 | companion object { 31 | fun forSymbol(symbol: String): Exchange { 32 | val name = when (symbol) { 33 | "A" -> "NYSE MKT" 34 | "N" -> "New York Stock Exchange (NYSE)" 35 | "P" -> "NYSE ARCA" 36 | "Z" -> "BATS Global Markets (BATS)" 37 | "V" -> "Investors' Exchange, LLC (IEXG)" 38 | else -> "Nasdaq" 39 | } 40 | return Exchange(name, symbol) 41 | } 42 | } 43 | } 44 | 45 | data class Tick(val symbol: String, val name: String, val category: String, val bid: Double, val ask: Double, val etf: Boolean, val lotSize: Int, val exchange: Exchange) { 46 | 47 | fun toMap(): Map { 48 | return mapOf( 49 | "symbol" to symbol, 50 | "name" to name, 51 | "category" to category, 52 | "bid" to bid.toString(), 53 | "ask" to ask.toString(), 54 | "etf" to etf.toString(), 55 | "lotSize" to lotSize.toString(), 56 | "exchange.name" to exchange.name, 57 | "exchange.symbol" to exchange.symbol 58 | ) 59 | } 60 | 61 | companion object { 62 | private val random = Random() 63 | fun gen(): Tick { 64 | val stock = Stock.stocks[random.nextInt(Stock.stocks.size)] 65 | val price = random.nextDouble() * 1000 66 | val spread = price / random.nextDouble() 67 | val bid = price - spread 68 | val ask = price + spread 69 | return Tick( 70 | stock.symbol, 71 | stock.name, 72 | listOf("N", "Q").shuffled().first(), 73 | bid, 74 | ask, 75 | stock.etf, 76 | random.nextInt(100) * 100, 77 | stock.exchange 78 | ) 79 | } 80 | } 81 | } -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/SubscriptionGenerator.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain 2 | 3 | import java.time.LocalDate 4 | import java.util.UUID 5 | 6 | import com.sksamuel.avro4s.AvroSchema 7 | import com.sksamuel.avro4s.RecordFormat 8 | import com.typesafe.scalalogging.StrictLogging 9 | import io.lenses.data.generator.config.DataGeneratorConfig 10 | import io.lenses.data.generator.kafka.Producers 11 | import org.apache.avro.Schema 12 | import org.apache.kafka.clients.producer.KafkaProducer 13 | import org.apache.kafka.clients.producer.ProducerRecord 14 | import org.apache.kafka.common.serialization.StringSerializer 15 | 16 | import scala.util.Random 17 | 18 | case class Subscription(customer_id: String, customer_name: String, subscription_date: LocalDate, expiry_date: LocalDate) 19 | 20 | object SubscriptionGenerator extends Generator with StrictLogging { 21 | val schema: Schema = AvroSchema[Subscription] 22 | println(schema.toString(true)) 23 | private val recordFormat = RecordFormat[Subscription] 24 | 25 | def generate: Subscription = { 26 | val date = LocalDate.of(2018, 1, 1).plusDays(Random.nextInt(31)).plusMonths(Random.nextInt(14)) 27 | Subscription(UUID.randomUUID().toString, names(Random.nextInt(names.length)), date, date.plusMonths(Random.nextInt(6) + 1)) 28 | } 29 | 30 | private val names = List( 31 | "Jim Hawkins", 32 | "Billy Bones", 33 | "John Trelawney", 34 | "Long John Silver", 35 | "Alexander Smollett", 36 | "Ben Gunn", 37 | "Israel Hands", 38 | "Tom Redruth", 39 | "David Livesey", 40 | "Abraham Gray", 41 | "Tom Morgan", 42 | "Dick Johnson", 43 | "Richard Joyce", 44 | "George Merry" 45 | ) 46 | 47 | override def avro(topic: String)(implicit config: DataGeneratorConfig): Unit = { 48 | 49 | val props = Producers.getAvroValueProducerProps(classOf[StringSerializer]) 50 | implicit val producer: KafkaProducer[String, Any] = new KafkaProducer[String, Any](props) 51 | 52 | logger.info(s"Publishing subscription data to '$topic'") 53 | 54 | try { 55 | Iterator.continually(generate).foreach { subscription => 56 | val container = recordFormat.to(subscription) 57 | val record = new ProducerRecord[String, Any](topic, container) 58 | producer.send(record) 59 | Thread.sleep(config.pauseBetweenRecordsMs) 60 | } 61 | } catch { 62 | case t: Throwable => 63 | logger.error(s"Failed to publish credit card data to '$topic'", t) 64 | } 65 | } 66 | 67 | override def json(topic: String)(implicit config: DataGeneratorConfig): Unit = ??? 68 | override def xml(topic: String)(implicit config: DataGeneratorConfig): Unit = ??? 69 | override def protobuf(topic: String)(implicit config: DataGeneratorConfig): Unit = ??? 70 | } 71 | -------------------------------------------------------------------------------- /datagen-elastic/src/main/scala/com/landoop/data/generator/Elastic.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator 2 | 3 | import com.sksamuel.elastic4s.http.ElasticClient 4 | import com.sksamuel.elastic4s.http.ElasticNodeEndpoint 5 | import com.sksamuel.elastic4s.http.ElasticProperties 6 | import com.typesafe.scalalogging.StrictLogging 7 | import io.lenses.data.generator.stocks.StockGenerator 8 | import scopt.OptionParser 9 | 10 | object Elastic extends App with StrictLogging { 11 | 12 | case class ElasticConfig(protocol: String, 13 | host: String, 14 | port: Int, 15 | index: String) 16 | 17 | logger.info( 18 | """ 19 | | 20 | | _ 21 | | | | ___ _ __ ___ ___ ___ 22 | | | | / _ \ '_ \/ __|/ _ \/ __| 23 | | | |__| __/ | | \__ \ __/\__ \ 24 | | |_____\___|_|_|_|___/\___||___/ _ 25 | | | _ \ __ _| |_ __ _ / ___| ___ _ __ ___ _ __ __ _| |_ ___ _ __ 26 | | | | | |/ _` | __/ _` | | | _ / _ \ '_ \ / _ \ '__/ _` | __/ _ \| '__| 27 | | | |_| | (_| | || (_| | | |_| | __/ | | | __/ | | (_| | || (_) | | 28 | | |____/ \__,_|\__\__,_| \____|\___|_| |_|\___|_| \__,_|\__\___/|_| 29 | | 30 | """.stripMargin) 31 | 32 | val parser: OptionParser[ElasticConfig] = new scopt.OptionParser[ElasticConfig]("generator") { 33 | head("generator") 34 | 35 | opt[String]("host").required().action { case (host, a) => 36 | a.copy(host = host) 37 | }.validate(f => if (f.trim.isEmpty) Left("Invalid host") else Right(())) 38 | .text("host") 39 | 40 | opt[Int]("port").required().action { case (port, a) => 41 | a.copy(port = port.toInt) 42 | }.text("port") 43 | 44 | opt[String]("index").required().action { case (index, a) => 45 | a.copy(index = index) 46 | }.validate(f => if (f.trim.isEmpty) Left("Invalid index") else Right(())) 47 | .text("index") 48 | 49 | opt[String]("protocol").required().action { case (protocol, a) => 50 | a.copy(protocol = protocol) 51 | }.validate(f => if (f.trim.isEmpty) Left("Invalid protocol") else Right(())) 52 | .text("protocolUrl") 53 | } 54 | 55 | parser.parse(args, ElasticConfig("", "", 80, "")).foreach { config => 56 | 57 | import com.sksamuel.elastic4s.http.ElasticDsl._ 58 | 59 | val endpoint = ElasticNodeEndpoint(config.protocol, config.host, config.port, None) 60 | val client = ElasticClient(ElasticProperties(Seq(endpoint))) 61 | 62 | for (_ <- 1 to 10000) { 63 | val tick = StockGenerator.generateTick 64 | client.execute { 65 | index(config.index, "type").fields(Map("category" -> tick.category, "etc" -> tick.etf, "symbol" -> tick.symbol, "name" -> tick.name, "bid" -> tick.bid, "ask" -> tick.ask, "lotsize" -> tick.lotSize)) 66 | } 67 | } 68 | 69 | client.close() 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /datagen-jms/src/main/scala/com/landoop/data/generator/JmsGenerator.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator 2 | 3 | import io.lenses.data.generator.stocks.StockGenerator 4 | import com.typesafe.scalalogging.StrictLogging 5 | import javax.jms.Session 6 | import org.apache.activemq.ActiveMQConnectionFactory 7 | import scopt.OptionParser 8 | 9 | object JmsGenerator extends App with StrictLogging { 10 | 11 | case class JmsConfig(url: String, queueName: String, count: Int) 12 | 13 | logger.info( 14 | """ 15 | | 16 | | _ 17 | | | | ___ _ __ ___ ___ ___ 18 | | | | / _ \ '_ \/ __|/ _ \/ __| 19 | | | |__| __/ | | \__ \ __/\__ \ 20 | | |_____\___|_|_|_|___/\___||___/ _ 21 | | | _ \ __ _| |_ __ _ / ___| ___ _ __ ___ _ __ __ _| |_ ___ _ __ 22 | | | | | |/ _` | __/ _` | | | _ / _ \ '_ \ / _ \ '__/ _` | __/ _ \| '__| 23 | | | |_| | (_| | || (_| | | |_| | __/ | | | __/ | | (_| | || (_) | | 24 | | |____/ \__,_|\__\__,_| \____|\___|_| |_|\___|_| \__,_|\__\___/|_| 25 | | 26 | """.stripMargin) 27 | 28 | val parser: OptionParser[JmsConfig] = new scopt.OptionParser[JmsConfig]("generator") { 29 | head("generator") 30 | 31 | opt[String]("url").required().action { case (url, a) => 32 | a.copy(url = url) 33 | }.validate(f => if (f.trim.isEmpty) Left("Invalid url") else Right(())) 34 | .text("url") 35 | 36 | opt[String]("queue").required().action { case (queue, a) => 37 | a.copy(queueName = queue) 38 | }.validate(f => if (f.trim.isEmpty) Left("Invalid queue") else Right(())) 39 | .text("queue") 40 | 41 | opt[Int]("count").optional().action { case (count, a) => 42 | a.copy(count = count) 43 | }.validate(f => Right(f)) 44 | .text("count") 45 | } 46 | 47 | parser.parse(args, JmsConfig("", "", 1000)).foreach { config => 48 | 49 | val factory = new ActiveMQConnectionFactory(config.url) 50 | val conn = factory.createConnection() 51 | conn.start() 52 | val sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE) 53 | val queue = sess.createQueue(config.queueName) 54 | 55 | val producer = sess.createProducer(queue) 56 | 57 | for (k <- 1 to config.count) { 58 | val tick = StockGenerator.generateTick 59 | val json = 60 | s"""{"category": "${tick.category}", 61 | |"etc": ${tick.etf}, 62 | |"symbol": "${tick.symbol}", 63 | |"name": "${tick.name}", 64 | |"bid": ${tick.bid}, 65 | |"ask": ${tick.ask}, 66 | |"lotsize": ${tick.lotSize} 67 | |} 68 | """.stripMargin 69 | val msg = sess.createTextMessage(json) 70 | producer.send(msg) 71 | if (k % 1000 == 0) 72 | println(s"Completed $k messsages") 73 | } 74 | 75 | producer.close() 76 | sess.close() 77 | conn.close() 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/DataGenerator.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain 2 | 3 | import com.sksamuel.avro4s.Record 4 | import com.sksamuel.avro4s.RecordFormat 5 | import com.typesafe.scalalogging.StrictLogging 6 | import io.lenses.data.generator.config.DataGeneratorConfig 7 | import io.lenses.data.generator.json.JacksonJson 8 | import io.lenses.data.generator.json.JacksonXml 9 | import io.lenses.data.generator.kafka.Producers 10 | import org.apache.avro.generic.GenericRecord 11 | import org.apache.kafka.clients.producer.KafkaProducer 12 | import org.apache.kafka.clients.producer.ProducerRecord 13 | import org.apache.kafka.common.serialization.ByteArraySerializer 14 | import org.apache.kafka.common.serialization.StringSerializer 15 | import pbdirect._ 16 | 17 | abstract class DataGenerator[T](implicit rf: RecordFormat[T], pbWriter: PBWriter[T]) 18 | extends Generator 19 | with StrictLogging { 20 | 21 | protected def generate(): Seq[(String, T)] 22 | 23 | private def generate[V](topic: String, delay: Long)(thunk: T => V) 24 | (implicit producer: KafkaProducer[String, V]): Unit = { 25 | Iterator.continually(generate()).flatten.foreach { case (k, v) => 26 | val record = new ProducerRecord(topic, k, thunk(v)) 27 | producer.send(record) 28 | Thread.sleep(delay) 29 | } 30 | } 31 | 32 | override def avro(topic: String)(implicit config: DataGeneratorConfig): Unit = { 33 | val props = Producers.getAvroValueProducerProps(classOf[StringSerializer]) 34 | implicit val producer: KafkaProducer[String, Record] = new KafkaProducer[String, Record](props) 35 | 36 | logger.info(s"Publishing sensor data to '$topic'") 37 | try { 38 | generate(topic, config.pauseBetweenRecordsMs)(rf.to) 39 | } 40 | catch { 41 | case t: Throwable => 42 | logger.error(s"Failed to publish credit card data to '$topic'", t) 43 | } 44 | } 45 | 46 | override def json(topic: String)(implicit config: DataGeneratorConfig): Unit = { 47 | val props = Producers.getStringValueProducerProps(classOf[StringSerializer]) 48 | implicit val producer: KafkaProducer[String, String] = new KafkaProducer[String, String](props) 49 | 50 | logger.info(s"Publishing sensor data to '$topic'") 51 | try { 52 | generate(topic, config.pauseBetweenRecordsMs)(JacksonJson.toJson) 53 | } 54 | catch { 55 | case t: Throwable => 56 | logger.error(s"Failed to publish credit card data to '$topic'", t) 57 | } 58 | } 59 | 60 | override def xml(topic: String)(implicit config: DataGeneratorConfig): Unit = { 61 | val props = Producers.getStringValueProducerProps(classOf[StringSerializer]) 62 | implicit val producer = new KafkaProducer[String, String](props) 63 | 64 | logger.info(s"Publishing sensor data to '$topic'") 65 | try { 66 | generate(topic, config.pauseBetweenRecordsMs)(JacksonXml.toXml) 67 | } 68 | catch { 69 | case t: Throwable => 70 | logger.error(s"Failed to publish credit card data to '$topic'", t) 71 | } 72 | } 73 | 74 | override def protobuf(topic: String)(implicit config: DataGeneratorConfig): Unit = { 75 | val props = Producers.getProducerProps(classOf[StringSerializer], classOf[ByteArraySerializer]) 76 | implicit val producer: KafkaProducer[String, Array[Byte]] = new KafkaProducer[String, Array[Byte]](props) 77 | 78 | logger.info(s"Publishing sensor data to '$topic'") 79 | try { 80 | generate(topic, config.pauseBetweenRecordsMs) { v => 81 | v.toPB 82 | } 83 | } 84 | catch { 85 | case t: Throwable => 86 | logger.error(s"Failed to publish credit card data to '$topic'", t) 87 | } 88 | } 89 | } 90 | 91 | object DataGenerator { 92 | 93 | import cats.syntax.invariant._ 94 | 95 | implicit val instantFormat: PBFormat[BigDecimal] = 96 | PBFormat[String].imap(BigDecimal(_))(_.toString()) 97 | 98 | } -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/payments/CreditCardGenerator.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain.payments 2 | 3 | import com.sksamuel.avro4s.RecordFormat 4 | import com.typesafe.scalalogging.StrictLogging 5 | import io.lenses.data.generator.config.DataGeneratorConfig 6 | import io.lenses.data.generator.domain.Generator 7 | import io.lenses.data.generator.json.JacksonJson 8 | import io.lenses.data.generator.json.JacksonXml 9 | import io.lenses.data.generator.kafka.Producers 10 | import org.apache.kafka.clients.producer.KafkaProducer 11 | import org.apache.kafka.clients.producer.ProducerRecord 12 | import org.apache.kafka.common.serialization.ByteArraySerializer 13 | import org.apache.kafka.common.serialization.StringSerializer 14 | import pbdirect._ 15 | 16 | object CreditCardGenerator extends Generator with StrictLogging { 17 | 18 | def avro(topic: String)(implicit config: DataGeneratorConfig) = { 19 | val props = Producers.getAvroValueProducerProps(classOf[StringSerializer]) 20 | val producer = new KafkaProducer[Any, Any](props) 21 | val rf = RecordFormat[CreditCard] 22 | 23 | logger.info(s"Publishing credit card data to '$topic'") 24 | try { 25 | CreditCard.Cards.foreach { cc => 26 | val record = new ProducerRecord[Any, Any](topic, cc.number, rf.to(cc)) 27 | producer.send(record) 28 | } 29 | producer.close() 30 | 31 | logger.info(s"Finished generating credit card data to '$topic'") 32 | } 33 | catch { 34 | case t: Throwable => 35 | logger.error(s"Failed to publish credit card data to '$topic'", t) 36 | } 37 | } 38 | 39 | override def json(topic: String)(implicit config: DataGeneratorConfig): Unit = { 40 | val props = Producers.getStringValueProducerProps(classOf[StringSerializer]) 41 | val producer = new KafkaProducer[Any, Any](props) 42 | 43 | logger.info(s"Publishing credit card data to '$topic'") 44 | try { 45 | CreditCard.Cards.foreach { cc => 46 | val record = new ProducerRecord[Any, Any](topic, cc.number, JacksonJson.toJson(cc)) 47 | producer.send(record) 48 | } 49 | producer.close() 50 | 51 | logger.info(s"Finished generating credit card data to '$topic'") 52 | } 53 | catch { 54 | case t: Throwable => 55 | logger.error(s"Failed to publish credit card data to '$topic'", t) 56 | } 57 | } 58 | 59 | override def xml(topic: String)(implicit config: DataGeneratorConfig): Unit = { 60 | val props = Producers.getStringValueProducerProps(classOf[StringSerializer]) 61 | val producer = new KafkaProducer[Any, Any](props) 62 | 63 | logger.info(s"Publishing credit card data to '$topic'") 64 | try { 65 | CreditCard.Cards.foreach { cc => 66 | val record = new ProducerRecord[Any, Any](topic, cc.number, JacksonXml.toXml(cc)) 67 | producer.send(record) 68 | } 69 | producer.close() 70 | 71 | logger.info(s"Finished generating credit card data to '$topic'") 72 | } 73 | catch { 74 | case t: Throwable => 75 | logger.error(s"Failed to publish credit card data to '$topic'", t) 76 | } 77 | } 78 | 79 | override def protobuf(topic: String)(implicit config: DataGeneratorConfig): Unit = { 80 | val props = Producers.getProducerProps(classOf[StringSerializer], classOf[ByteArraySerializer]) 81 | implicit val producer: KafkaProducer[String, Array[Byte]] = new KafkaProducer(props) 82 | 83 | logger.info(s"Publishing credit card data to '$topic'") 84 | try { 85 | CreditCard.Cards.foreach { cc => 86 | val record = new ProducerRecord(topic, cc.number, cc.toPB) 87 | producer.send(record) 88 | } 89 | producer.close() 90 | 91 | logger.info(s"Finished generating credit card data to '$topic'") 92 | } 93 | catch { 94 | case t: Throwable => 95 | logger.error(s"Failed to publish credit card data to '$topic'", t) 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /datagen-pulsar/src/main/scala/io/lenses/data/generator/Pulsar.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator 2 | 3 | import com.sksamuel.pulsar4s.{ProducerConfig, PulsarClient, Topic} 4 | import com.typesafe.scalalogging.StrictLogging 5 | import io.lenses.data.generator.stocks.StockGenerator 6 | import io.lenses.data.generator.stocks.StockGenerator 7 | import io.lenses.data.generator.stocks.Tick 8 | import org.apache.pulsar.client.admin.PulsarAdmin 9 | import org.apache.pulsar.client.impl.conf.ClientConfigurationData 10 | import org.apache.pulsar.common.policies.data.TenantInfo 11 | import scopt.OptionParser 12 | 13 | object Pulsar extends App with StrictLogging { 14 | 15 | import scala.collection.JavaConverters._ 16 | 17 | case class PulsarConfig(tenant: String, 18 | namespace: String, 19 | topic: String, 20 | brokerUrl: String, 21 | httpUrl: String) 22 | 23 | logger.info( 24 | """ 25 | | 26 | | _ 27 | | | | ___ _ __ ___ ___ ___ 28 | | | | / _ \ '_ \/ __|/ _ \/ __| 29 | | | |__| __/ | | \__ \ __/\__ \ 30 | | |_____\___|_|_|_|___/\___||___/ _ 31 | | | _ \ __ _| |_ __ _ / ___| ___ _ __ ___ _ __ __ _| |_ ___ _ __ 32 | | | | | |/ _` | __/ _` | | | _ / _ \ '_ \ / _ \ '__/ _` | __/ _ \| '__| 33 | | | |_| | (_| | || (_| | | |_| | __/ | | | __/ | | (_| | || (_) | | 34 | | |____/ \__,_|\__\__,_| \____|\___|_| |_|\___|_| \__,_|\__\___/|_| 35 | | 36 | """.stripMargin) 37 | 38 | val parser: OptionParser[PulsarConfig] = new scopt.OptionParser[PulsarConfig]("generator") { 39 | head("generator") 40 | 41 | opt[String]("tenant").required().action { case (tenant, a) => 42 | a.copy(tenant = tenant) 43 | }.validate(f => if (f.trim.isEmpty) Left("Invalid tenant") else Right(())) 44 | .text("Pulsar tenant") 45 | 46 | opt[String]("namespace").required().action { case (namespace, a) => 47 | a.copy(namespace = namespace) 48 | }.validate(f => if (f.trim.isEmpty) Left("Invalid namespace") else Right(())) 49 | .text("Pulsar namespace") 50 | 51 | opt[String]("topic").required().action { case (topic, a) => 52 | a.copy(topic = topic) 53 | }.validate(f => if (f.trim.isEmpty) Left("Invalid topic") else Right(())) 54 | .text("Pulsar topic") 55 | 56 | opt[String]("brokerUrl").required().action { case (brokerUrl, a) => 57 | a.copy(brokerUrl = brokerUrl) 58 | }.validate(f => if (f.trim.isEmpty) Left("Invalid brokerUrl") else Right(())) 59 | .text("Pulsar binaryUrl") 60 | 61 | opt[String]("httpUrl").required().action { case (httpUrl, a) => 62 | a.copy(httpUrl = httpUrl) 63 | }.validate(f => if (f.trim.isEmpty) Left("Invalid httpUrl") else Right(())) 64 | .text("Pulsar httpUrl") 65 | } 66 | 67 | parser.parse(args, PulsarConfig("", "", "", "", "")).foreach { config => 68 | 69 | val adminConfig = new ClientConfigurationData() 70 | val admin = new PulsarAdmin(config.httpUrl, adminConfig) 71 | 72 | if (!admin.tenants().getTenants.contains(config.tenant)) { 73 | admin.tenants().createTenant(config.tenant, new TenantInfo(Set.empty[String].asJava, Set("standalone").asJava)) 74 | } 75 | 76 | if (!admin.namespaces().getNamespaces(config.tenant).contains(config.tenant + "/" + config.namespace)) { 77 | admin.namespaces().createNamespace(config.tenant + "/" + config.namespace, Set("standalone").asJava) 78 | } 79 | 80 | val client = PulsarClient(config.brokerUrl) 81 | val topic = Topic(s"persistent://${config.tenant}/${config.namespace}/${config.topic}") 82 | val producer = client.producer[Tick](ProducerConfig(topic, enableBatching = Some(false)))(TickSchema) 83 | 84 | for (_ <- 1 to 10000) { 85 | producer.send(StockGenerator.generateTick) 86 | println("LastSequenceId=" + producer.lastSequenceId) 87 | } 88 | 89 | producer.close() 90 | client.close() 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/bikesharing/StationsGenerator.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain.bikesharing 2 | 3 | import com.sksamuel.avro4s.RecordFormat 4 | import com.typesafe.scalalogging.StrictLogging 5 | import io.lenses.data.generator.config.DataGeneratorConfig 6 | import io.lenses.data.generator.domain.Generator 7 | import io.lenses.data.generator.json.JacksonJson 8 | import io.lenses.data.generator.json.JacksonXml 9 | import io.lenses.data.generator.kafka.Producers 10 | import org.apache.kafka.clients.producer.KafkaProducer 11 | import org.apache.kafka.clients.producer.ProducerRecord 12 | import org.apache.kafka.common.serialization.ByteArraySerializer 13 | import org.apache.kafka.common.serialization.IntegerSerializer 14 | import pbdirect._ 15 | 16 | object StationsGenerator extends Generator with StrictLogging { 17 | 18 | def avro(topic: String)(implicit config: DataGeneratorConfig): Unit = { 19 | val props = Producers.getAvroValueProducerProps(classOf[IntegerSerializer]) 20 | val producer = new KafkaProducer[Any, Any](props) 21 | val rf = RecordFormat[Station] 22 | 23 | logger.info(s"Publishing bike sharing station data to '$topic'") 24 | try { 25 | Station.fromDb().foreach { station => 26 | val record = new ProducerRecord[Any, Any](topic, station.id, rf.to(station)) 27 | producer.send(record) 28 | } 29 | producer.close() 30 | 31 | logger.info(s"Finished generating bike sharing station to '$topic'") 32 | } 33 | catch { 34 | case t: Throwable => 35 | logger.error(s"Failed to publish bike sharing station to '$topic'", t) 36 | } 37 | } 38 | 39 | override def json(topic: String)(implicit config: DataGeneratorConfig): Unit = { 40 | val props = Producers.getStringValueProducerProps(classOf[IntegerSerializer]) 41 | val producer = new KafkaProducer[Any, Any](props) 42 | 43 | logger.info(s"Publishing bike sharing station to '$topic'") 44 | try { 45 | Station.fromDb().foreach { station => 46 | val record = new ProducerRecord[Any, Any](topic, station.id, JacksonJson.toJson(station)) 47 | producer.send(record) 48 | } 49 | producer.close() 50 | 51 | logger.info(s"Finished generating bike sharing station to '$topic'") 52 | } 53 | catch { 54 | case t: Throwable => 55 | logger.error(s"Failed to publish bike sharing station to '$topic'", t) 56 | } 57 | } 58 | 59 | override def xml(topic: String)(implicit config: DataGeneratorConfig): Unit = { 60 | val props = Producers.getStringValueProducerProps(classOf[IntegerSerializer]) 61 | val producer = new KafkaProducer[Any, Any](props) 62 | 63 | logger.info(s"Publishing bike sharing station to '$topic'") 64 | try { 65 | Station.fromDb().foreach { station => 66 | val record = new ProducerRecord[Any, Any](topic, station.id, JacksonXml.toXml(station)) 67 | producer.send(record) 68 | } 69 | producer.close() 70 | 71 | logger.info(s"Finished generating bike sharing station to '$topic'") 72 | } 73 | catch { 74 | case t: Throwable => 75 | logger.error(s"Failed to publish bike sharing station to '$topic'", t) 76 | } 77 | } 78 | 79 | override def protobuf(topic: String)(implicit config: DataGeneratorConfig): Unit = { 80 | val props = Producers.getProducerProps(classOf[IntegerSerializer], classOf[ByteArraySerializer]) 81 | implicit val producer: KafkaProducer[Int, Array[Byte]] = new KafkaProducer(props) 82 | 83 | logger.info(s"Publishing bike sharing station to '$topic'") 84 | try { 85 | Station.fromDb().foreach { station => 86 | val record = new ProducerRecord(topic, station.id, station.toPB) 87 | producer.send(record) 88 | } 89 | producer.close() 90 | 91 | logger.info(s"Finished generating bike sharing station to '$topic'") 92 | } 93 | catch { 94 | case t: Throwable => 95 | logger.error(s"Failed to publish bike sharing station to '$topic'", t) 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/weather/WeatherDataGenerator.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain.weather 2 | 3 | import java.io.ByteArrayOutputStream 4 | 5 | import io.lenses.data.generator.config.DataGeneratorConfig 6 | import io.lenses.data.generator.kafka.Producers 7 | import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream 8 | import io.lenses.data.generator.config.DataGeneratorConfig 9 | import io.lenses.data.generator.domain.DataGenerator 10 | import io.lenses.data.generator.kafka.Producers 11 | import org.apache.kafka.clients.producer.{KafkaProducer, ProducerRecord} 12 | import org.apache.kafka.common.serialization.{ByteArraySerializer, StringSerializer} 13 | import org.joda.time.DateTime 14 | 15 | import scala.util.Random 16 | 17 | object WeatherDataGenerator extends DataGenerator[WeatherS] { 18 | 19 | private val textValues = Vector("Sunny", "Cloudy", "Mostly Cloudy", "Snowing", "Showers", "Heavy Showers") 20 | private val dayOfWeekMap = Map(1 -> "Monday", 2 -> "Tuesday", 3 -> "Wednesday", 4 -> "Thursday", 5 -> "Friday", 6 -> "Saturday", 7 -> "Sunday") 21 | 22 | private def randWeather() = { 23 | val now = DateTime.now() 24 | val forecasts = (1 to 10).map { i => 25 | val d = now.plusDays(1) 26 | ForecastS(d.toString(), dayOfWeekMap(d.dayOfWeek().get()), Random.nextInt(100), Random.nextInt(), textValues(Random.nextInt(textValues.size))) 27 | }.toList 28 | 29 | 30 | WeatherS( 31 | WindS(Random.nextInt(), Random.nextInt(360), Random.nextInt(200)), 32 | AtmosphereS(Random.nextInt(100), 100 * Random.nextDouble(), Random.nextInt(), Random.nextDouble() * 100), 33 | forecasts) 34 | } 35 | 36 | override protected def generate(): Seq[(String, WeatherS)] = { 37 | val cities = List("London", "New York", "Paris", "Barcelona", "Tokyo", "Athens", "Sibiu") 38 | cities.map { c => c -> randWeather() } 39 | } 40 | 41 | private def randWeatherJ() = { 42 | val now = DateTime.now() 43 | val forecasts = (1 to 10).map { i => 44 | val d = now.plusDays(1) 45 | WeatherOuterClass.Forecast.newBuilder() 46 | .setDate(d.toString()) 47 | .setDay(dayOfWeekMap(d.dayOfWeek().get())) 48 | .setHigh(Random.nextInt(100)) 49 | .setLow(Random.nextInt()) 50 | .setText(textValues(Random.nextInt(textValues.size))) 51 | .build() 52 | }.toList 53 | 54 | 55 | val wind = WeatherOuterClass.Wind.newBuilder() 56 | .setChill(Random.nextInt()) 57 | .setDirection(Random.nextInt(360)) 58 | .setSpeed(Random.nextInt(200)) 59 | .build() 60 | 61 | val atmosphere = WeatherOuterClass.Atmosphere.newBuilder() 62 | .setHumidity(Random.nextInt(100)) 63 | .setPressure(100 * Random.nextDouble()) 64 | .setRising(Random.nextInt()) 65 | .setVisibility(100 * Random.nextDouble()) 66 | .build() 67 | 68 | val builder = WeatherOuterClass.Weather.newBuilder() 69 | .setWind(wind) 70 | .setAtmosphere(atmosphere) 71 | 72 | forecasts.foreach(builder.addForecast) 73 | builder.build() 74 | } 75 | 76 | 77 | override def protobuf(topic: String)(implicit config: DataGeneratorConfig): Unit = { 78 | val props = Producers.getProducerProps(classOf[StringSerializer], classOf[ByteArraySerializer]) 79 | implicit val producer: KafkaProducer[String, Array[Byte]] = new KafkaProducer[String, Array[Byte]](props) 80 | 81 | logger.info(s"Publishing sensor data to '$topic'") 82 | try { 83 | val cities = List("London", "New York", "Paris", "Barcelona", "Tokyo", "Athens", "Sibiu") 84 | while (true) { 85 | cities.map { c => c -> randWeatherJ() }.foreach { case (k, v) => 86 | val bos = new ByteArrayOutputStream() 87 | v.writeTo(bos) 88 | val value = bos.toByteArray 89 | 90 | producer.send(new ProducerRecord(topic, k, value)) 91 | bos.close() 92 | } 93 | Thread.sleep(config.pauseBetweenRecordsMs) 94 | } 95 | } 96 | catch { 97 | case t: Throwable => 98 | logger.error(s"Failed to publish credit card data to '$topic'", t) 99 | } 100 | producer.close() 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/bikesharing/TripsGenerator.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain.bikesharing 2 | 3 | import com.sksamuel.avro4s.RecordFormat 4 | import com.typesafe.scalalogging.StrictLogging 5 | import io.lenses.data.generator.config.DataGeneratorConfig 6 | import io.lenses.data.generator.domain.Generator 7 | import io.lenses.data.generator.json.JacksonJson 8 | import io.lenses.data.generator.json.JacksonXml 9 | import io.lenses.data.generator.kafka.Producers 10 | import org.apache.kafka.clients.producer.KafkaProducer 11 | import org.apache.kafka.clients.producer.ProducerRecord 12 | import org.apache.kafka.common.serialization.IntegerSerializer 13 | 14 | object TripsGenerator extends Generator with StrictLogging { 15 | 16 | def avro(topic: String)(implicit config: DataGeneratorConfig): Unit = { 17 | val props = Producers.getAvroValueProducerProps(classOf[IntegerSerializer]) 18 | val producer = new KafkaProducer[Any, Any](props) 19 | val rf = RecordFormat[Trip] 20 | 21 | logger.info(s"Publishing bike sharing trip data to '$topic'") 22 | try { 23 | Trip.fromDb().foreach { trip => 24 | val record = new ProducerRecord[Any, Any](topic, trip.id, rf.to(trip)) 25 | record.headers() 26 | .add("Lenses", "2.3.0".getBytes()) 27 | .add("User", "Lenses-Training".getBytes()) 28 | producer.send(record) 29 | } 30 | producer.close() 31 | 32 | logger.info(s"Finished generating bike sharing trip data to '$topic'") 33 | } 34 | catch { 35 | case t: Throwable => 36 | logger.error(s"Failed to publish bike sharing trip data to '$topic'", t) 37 | } 38 | } 39 | 40 | override def json(topic: String)(implicit config: DataGeneratorConfig): Unit = { 41 | val props = Producers.getStringValueProducerProps(classOf[IntegerSerializer]) 42 | val producer = new KafkaProducer[Any, Any](props) 43 | 44 | logger.info(s"Publishing bike sharing trip data to '$topic'") 45 | try { 46 | Trip.fromDb().foreach { trip => 47 | val record = new ProducerRecord[Any, Any](topic, trip.id, JacksonJson.toJson(trip)) 48 | record.headers() 49 | .add("Lenses", "2.3.0".getBytes()) 50 | .add("User", "Lenses-Training".getBytes()) 51 | producer.send(record) 52 | } 53 | producer.close() 54 | 55 | logger.info(s"Finished generating bike sharing trip data to '$topic'") 56 | } 57 | catch { 58 | case t: Throwable => 59 | logger.error(s"Failed to publish bike sharing trip data to '$topic'", t) 60 | } 61 | } 62 | 63 | override def xml(topic: String)(implicit config: DataGeneratorConfig): Unit = { 64 | val props = Producers.getStringValueProducerProps(classOf[IntegerSerializer]) 65 | val producer = new KafkaProducer[Any, Any](props) 66 | 67 | logger.info(s"Publishing bike sharing trip data to '$topic'") 68 | try { 69 | Trip.fromDb().foreach { trip => 70 | val record = new ProducerRecord[Any, Any](topic, trip.id, JacksonXml.toXml(trip)) 71 | producer.send(record) 72 | } 73 | producer.close() 74 | 75 | logger.info(s"Finished generating bike sharing trip data to '$topic'") 76 | } 77 | catch { 78 | case t: Throwable => 79 | logger.error(s"Failed to publish bike sharing trip data to '$topic'", t) 80 | } 81 | } 82 | 83 | override def protobuf(topic: String)(implicit config: DataGeneratorConfig): Unit = { 84 | /*val props = Producers.getProducerProps(classOf[IntegerSerializer], classOf[ByteArraySerializer]) 85 | implicit val producer: KafkaProducer[Int, Array[Byte]] = new KafkaProducer(props) 86 | 87 | logger.info(s"Publishing bike sharing trip data to '$topic'") 88 | try { 89 | Trip.fromDb().foreach { trip => 90 | val record = new ProducerRecord(topic, trip.id, trip.toPB) 91 | producer.send(record) 92 | } 93 | producer.close() 94 | 95 | logger.info(s"Finished generating bike sharing trip data to '$topic'") 96 | } 97 | catch { 98 | case t: Throwable => 99 | logger.error(s"Failed to publish bike sharing trip data to '$topic'", t) 100 | }*/ 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /datagen-hive/src/main/scala/io/lenses/datagen/hive/HiveGenerator.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.datagen.hive 2 | 3 | import com.sksamuel.rxhive.evolution.NoopSchemaEvolver 4 | import com.sksamuel.rxhive.formats.ParquetFormat 5 | import com.sksamuel.rxhive.partitioners.DynamicPartitioner 6 | import com.sksamuel.rxhive.resolver.LenientStructResolver 7 | import com.sksamuel.rxhive.{CreateTableConfig, DatabaseName, Float64Type, HiveUtils, HiveWriter, Int32Type, PartitionKey, PartitionPlan, RxHiveFileNamer, StagingFileManager, StringType, Struct, StructField, StructType, TableName, WriteMode} 8 | import com.typesafe.scalalogging.StrictLogging 9 | import io.lenses.data.generator.stocks.StockGenerator 10 | import org.apache.hadoop.conf.Configuration 11 | import org.apache.hadoop.fs.FileSystem 12 | import org.apache.hadoop.hive.conf.HiveConf 13 | import org.apache.hadoop.hive.metastore.{HiveMetaStoreClient, TableType} 14 | import scopt.OptionParser 15 | 16 | object HiveGenerator extends App with StrictLogging { 17 | 18 | case class HiveDataGenConfig(table: String, database: String, metastoreUris: String, defaultFS: String, count: Int, partitions: List[String]) 19 | 20 | logger.info( 21 | """ 22 | | 23 | | _ 24 | | | | ___ _ __ ___ ___ ___ 25 | | | | / _ \ '_ \/ __|/ _ \/ __| 26 | | | |__| __/ | | \__ \ __/\__ \ 27 | | |_____\___|_|_|_|___/\___||___/ _ 28 | | | _ \ __ _| |_ __ _ / ___| ___ _ __ ___ _ __ __ _| |_ ___ _ __ 29 | | | | | |/ _` | __/ _` | | | _ / _ \ '_ \ / _ \ '__/ _` | __/ _ \| '__| 30 | | | |_| | (_| | || (_| | | |_| | __/ | | | __/ | | (_| | || (_) | | 31 | | |____/ \__,_|\__\__,_| \____|\___|_| |_|\___|_| \__,_|\__\___/|_| 32 | | 33 | """.stripMargin) 34 | 35 | val parser: OptionParser[HiveDataGenConfig] = new scopt.OptionParser[HiveDataGenConfig]("generator") { 36 | head("generator") 37 | 38 | opt[String]("metastore-uris").optional().action { case (uris, conf) => 39 | conf.copy(metastoreUris = uris) 40 | } 41 | 42 | opt[String]("default-fs").optional().action { case (defaultFs, a) => 43 | a.copy(defaultFS = defaultFs) 44 | } 45 | 46 | opt[Int]("count").optional().action { case (count, a) => 47 | a.copy(count = count) 48 | } 49 | 50 | opt[String]("database").optional().action { case (database, a) => 51 | a.copy(database = database) 52 | } 53 | 54 | opt[String]("table").optional().action { case (table, a) => 55 | a.copy(table = table) 56 | } 57 | 58 | opt[String]("partitions").optional().action { case (partitions, a) => 59 | a.copy(partitions = partitions.split(',').map(_.trim).toList) 60 | } 61 | } 62 | 63 | parser.parse(args, HiveDataGenConfig("", "", "", "", 1000, Nil)).foreach { config => 64 | require(config.defaultFS.nonEmpty) 65 | require(config.metastoreUris.nonEmpty) 66 | require(config.table.nonEmpty) 67 | require(config.database.nonEmpty) 68 | 69 | implicit val hiveConf: HiveConf = new HiveConf() 70 | hiveConf.set("hive.metastore", "thrift") 71 | hiveConf.set("hive.metastore.uris", config.metastoreUris) 72 | 73 | implicit val client: HiveMetaStoreClient = new HiveMetaStoreClient(hiveConf) 74 | 75 | implicit val conf: Configuration = new Configuration() 76 | conf.setBoolean("fs.hdfs.impl.disable.cache", true) 77 | conf.set("fs.defaultFS", config.defaultFS) 78 | 79 | implicit val fs: FileSystem = FileSystem.get(conf) 80 | 81 | val schema = new StructType( 82 | new StructField("category", StringType.INSTANCE), 83 | new StructField("etf", StringType.INSTANCE), 84 | new StructField("symbol", StringType.INSTANCE), 85 | new StructField("name", StringType.INSTANCE), 86 | new StructField("bid", Float64Type.INSTANCE), 87 | new StructField("ask", Float64Type.INSTANCE), 88 | new StructField("lot-size", Int32Type.INSTANCE) 89 | ) 90 | 91 | new HiveUtils(client, fs).dropTable(new DatabaseName(config.database), new TableName(config.table), true) 92 | 93 | import scala.collection.JavaConverters._ 94 | val plan = if (config.partitions.isEmpty) null else new PartitionPlan(config.partitions.map(new PartitionKey(_)).asJava) 95 | 96 | val createConfig = new CreateTableConfig(schema, plan, TableType.MANAGED_TABLE, ParquetFormat.INSTANCE, null) 97 | val writer = new HiveWriter(new DatabaseName(config.database), new TableName(config.table), WriteMode.Create, DynamicPartitioner.INSTANCE, new StagingFileManager(RxHiveFileNamer.INSTANCE), NoopSchemaEvolver.INSTANCE, LenientStructResolver.INSTANCE, createConfig, client, fs) 98 | 99 | for (k <- 1 to config.count) { 100 | val tick = StockGenerator.generateTick 101 | val struct = new Struct(schema, tick.category, java.lang.Boolean.valueOf(tick.etf), tick.symbol, tick.name, java.lang.Double.valueOf(tick.bid), java.lang.Double.valueOf(tick.ask), java.lang.Integer.valueOf(tick.lotSize)) 102 | writer.write(struct) 103 | if (k % 1000 == 0) 104 | println(s"Completed $k messsages") 105 | } 106 | 107 | writer.close() 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/domain/iot/DeviceTemperatureArrayDataGenerator.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain.iot 2 | 3 | import com.sksamuel.avro4s.RecordFormat 4 | import com.sksamuel.avro4s.SchemaFor 5 | import com.typesafe.scalalogging.StrictLogging 6 | import io.lenses.data.generator.config.DataGeneratorConfig 7 | import io.lenses.data.generator.domain.Generator 8 | import io.lenses.data.generator.json.JacksonJson 9 | import io.lenses.data.generator.json.JacksonXml 10 | import io.lenses.data.generator.kafka.Producers 11 | import org.apache.avro.SchemaBuilder 12 | import org.apache.avro.generic.GenericContainer 13 | import org.apache.avro.generic.GenericData 14 | import org.apache.avro.generic.GenericData.Record 15 | import org.apache.kafka.clients.producer.KafkaProducer 16 | import org.apache.kafka.clients.producer.ProducerRecord 17 | import org.apache.kafka.common.serialization.StringSerializer 18 | import org.joda.time.DateTime 19 | import pbdirect._ 20 | 21 | import scala.collection.JavaConverters._ 22 | import scala.util.Random 23 | 24 | object DeviceTemperatureArrayDataGenerator extends Generator with StrictLogging with PBWriterImplicits { 25 | private val devices = (1 to 10).map { i => s"cD$i" }.toList 26 | 27 | /* 28 | 29 | implicit def listWriter[K](implicit writer: PBWriter[K]): PBWriter[List[K]] = { 30 | new PBWriter[List[K]] { 31 | override def writeTo(index: Int, value: List[K], out: CodedOutputStream): Unit = { 32 | value.zipWithIndex.foreach { case (k, i) => 33 | writer.writeTo(i + index, k, out) 34 | } 35 | } 36 | } 37 | } 38 | */ 39 | 40 | //implicit val wDeviceTemperatureArray = listWriter[DeviceTemperature] 41 | 42 | protected def generate(): List[DeviceTemperature] = { 43 | devices.map { d => 44 | DeviceTemperature( 45 | d, 46 | "Temperature", 47 | List(Random.nextInt(), Random.nextInt(), Random.nextInt(), Random.nextInt())) 48 | } 49 | } 50 | 51 | private def generate[V](topic: String, delay: Long)(thunk: List[DeviceTemperature] => V)(implicit producer: KafkaProducer[String, V]): Unit = { 52 | Iterator.continually(generate()).foreach { devices => 53 | val record = new ProducerRecord(topic, DateTime.now.toString(), thunk(devices)) 54 | producer.send(record) 55 | Thread.sleep(delay) 56 | } 57 | } 58 | 59 | override def avro(topic: String)(implicit config: DataGeneratorConfig): Unit = { 60 | val props = Producers.getAvroValueProducerProps(classOf[StringSerializer]) 61 | implicit val producer: KafkaProducer[String, GenericContainer] = new KafkaProducer[String, GenericContainer](props) 62 | 63 | logger.info(s"Publishing sensor data to '$topic'") 64 | val deviceSchema = SchemaFor[DeviceTemperature] 65 | val schema = SchemaBuilder.array().items(deviceSchema.schema) 66 | val rf = RecordFormat[DeviceTemperature] 67 | try 68 | generate(topic, config.pauseBetweenRecordsMs) { devices: List[DeviceTemperature] => 69 | new GenericData.Array[GenericContainer]( 70 | schema, 71 | devices.map(rf.to).map(_.asInstanceOf[GenericContainer]).asJava 72 | ).asInstanceOf[GenericContainer] 73 | } 74 | 75 | catch { 76 | case t: Throwable => 77 | logger.error(s"Failed to publish credit card data to '$topic'", t) 78 | } 79 | } 80 | 81 | override def json(topic: String)(implicit config: DataGeneratorConfig): Unit = { 82 | val props = Producers.getStringValueProducerProps(classOf[StringSerializer]) 83 | implicit val producer = new KafkaProducer[String, String](props) 84 | 85 | logger.info(s"Publishing sensor data to '$topic'") 86 | try { 87 | generate(topic, config.pauseBetweenRecordsMs)(JacksonJson.toJson) 88 | } 89 | catch { 90 | case t: Throwable => 91 | logger.error(s"Failed to publish credit card data to '$topic'", t) 92 | } 93 | } 94 | 95 | override def xml(topic: String)(implicit config: DataGeneratorConfig): Unit = { 96 | val props = Producers.getStringValueProducerProps(classOf[StringSerializer]) 97 | implicit val producer = new KafkaProducer[String, String](props) 98 | 99 | logger.info(s"Publishing sensor data to '$topic'") 100 | try { 101 | generate(topic, config.pauseBetweenRecordsMs)(d => JacksonXml.toXml(d.asJava)) 102 | } 103 | catch { 104 | case t: Throwable => 105 | logger.error(s"Failed to publish credit card data to '$topic'", t) 106 | } 107 | } 108 | 109 | override def protobuf(topic: String)(implicit config: DataGeneratorConfig): Unit = { 110 | throw new RuntimeException("Not supported") 111 | /*val props = Producers.getProducerProps(classOf[StringSerializer], classOf[ByteArraySerializer]) 112 | implicit val producer: KafkaProducer[String, Array[Byte]] = new KafkaProducer(props) 113 | 114 | logger.info(s"Publishing payments data to '$topic'") 115 | try { 116 | 117 | generate(topic, config.pauseBetweenRecordsMs) { p => 118 | p.foreach{d=> 119 | val b = d.toPB 120 | } 121 | Array.empty[Byte] 122 | } 123 | } 124 | catch { 125 | case t: Throwable => 126 | logger.error(s"Failed to publish credit card data to '$topic'", t) 127 | }*/ 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/scala/io/lenses/data/generator/Program.scala: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator 2 | 3 | import java.net.URL 4 | 5 | import io.lenses.data.generator.config.DataGeneratorConfig 6 | import io.lenses.data.generator.domain.{Generator, SubscriptionGenerator} 7 | import io.lenses.data.generator.domain.iot.{DeviceTemperatureArrayDataGenerator, DeviceTemperatureDataGenerator, SensorDataGenerator} 8 | import io.lenses.data.generator.domain.payments.{CreditCardGenerator, PaymentsGenerator} 9 | import io.lenses.data.generator.domain.weather.WeatherDataGenerator 10 | import com.typesafe.scalalogging.StrictLogging 11 | import io.lenses.data.generator.config.DataGeneratorConfig 12 | import io.lenses.data.generator.domain.SubscriptionGenerator 13 | import io.lenses.data.generator.domain.iot.DeviceTemperatureArrayDataGenerator 14 | import io.lenses.data.generator.domain.iot.SensorDataGenerator 15 | import io.lenses.data.generator.domain.payments.PaymentsGenerator 16 | import io.lenses.data.generator.domain.weather.WeatherDataGenerator 17 | import io.lenses.data.generator.domain.Generator 18 | import io.lenses.data.generator.domain.bikesharing.StationsGenerator 19 | import io.lenses.data.generator.domain.bikesharing.TripsGenerator 20 | import io.lenses.data.generator.domain.iot.DeviceTemperatureDataGenerator 21 | import io.lenses.data.generator.domain.payments.CreditCardGenerator 22 | import scopt.Read 23 | 24 | import scala.util.Try 25 | 26 | object Program extends App with StrictLogging { 27 | val generators = Map[Int, Generator]( 28 | 1 -> CreditCardGenerator, 29 | 2 -> PaymentsGenerator, 30 | 3 -> SensorDataGenerator, 31 | 4 -> WeatherDataGenerator, 32 | 5 -> DeviceTemperatureDataGenerator, 33 | 6 -> DeviceTemperatureArrayDataGenerator, 34 | 7 -> SubscriptionGenerator, 35 | 8 -> StationsGenerator, 36 | 9 -> TripsGenerator 37 | ) 38 | 39 | logger.info( 40 | """ 41 | | 42 | | _ 43 | | | | ___ _ __ ___ ___ ___ 44 | | | | / _ \ '_ \/ __|/ _ \/ __| 45 | | | |__| __/ | | \__ \ __/\__ \ 46 | | |_____\___|_|_|_|___/\___||___/ _ 47 | | | _ \ __ _| |_ __ _ / ___| ___ _ __ ___ _ __ __ _| |_ ___ _ __ 48 | | | | | |/ _` | __/ _` | | | _ / _ \ '_ \ / _ \ '__/ _` | __/ _ \| '__| 49 | | | |_| | (_| | || (_| | | |_| | __/ | | | __/ | | (_| | || (_) | | 50 | | |____/ \__,_|\__\__,_| \____|\___|_| |_|\___|_| \__,_|\__\___/|_| 51 | | 52 | """.stripMargin) 53 | 54 | val parser = new scopt.OptionParser[Arguments]("generator") { 55 | head("generator") 56 | 57 | opt[String]("topic").required().action { case (b, a) => 58 | a.copy(topic = b) 59 | }.validate(f => if (f.trim.isEmpty) Left("Invalid topic") else Right(())) 60 | .text("Kafka topic to publish to") 61 | 62 | opt[Int]("partitions").action { case (b, a) => 63 | a.copy(partitions = b) 64 | }.text("Topic partitions") 65 | 66 | opt[Int]("replication").action { case (b, a) => 67 | a.copy(replication = b) 68 | }.text("Topic replication") 69 | 70 | opt[String]("brokers").required().action { case (b, a) => 71 | a.copy(brokers = b) 72 | }.validate(f => if (f.trim.isEmpty) Left("Invalid Kafka bootstrap brokers") else Right(())) 73 | .text("Kafka bootstrap brokers") 74 | 75 | opt[String]("schema").action { case (v, a) => 76 | a.copy(schemaRegistry = v) 77 | }.validate(f => if (f.trim.nonEmpty && Try(new URL(f.trim)).isSuccess) Right(()) else Left("Invalid Schema Registry URL")) 78 | .text("Schema Registry URL") 79 | 80 | opt[String]("schema.mode").action { case (v, a) => 81 | val mode = v.trim.toLowerCase() 82 | a.copy(defaultSchemaRegistry = mode == "hortonworks" || mode == "hw") 83 | }.text("Schema registry mode. Use 'hw/hortonworks' to use the hortonworks serializers") 84 | 85 | implicit val evFormatType: Read[FormatType] = new scopt.Read[FormatType] { 86 | override def arity: Int = 1 87 | 88 | override def reads: String => FormatType = a => FormatType.valueOf(a.trim.toUpperCase()) 89 | } 90 | opt[FormatType]("format").required().action { case (v, a) => 91 | a.copy(format = v) 92 | }.text("Format type. AVRO/JSON/XML") 93 | 94 | opt[Int]("data").required().action((v, a) => a.copy(dataSet = v)) 95 | .validate(v => if (v < 0 && v > 5) Left("Invalid data set option. Available options are 1 to 5") else Right(())) 96 | .text( 97 | """ 98 | |Data set type. 99 | |Available options: 100 | | 1 - credit card data 101 | | 2 - payments data 102 | | 3 - sensor data 103 | | 4 - weather data 104 | | 5 - device temperature 105 | | 6 - device temperature array""".stripMargin) 106 | } 107 | 108 | parser.parse(args, Arguments("", 1, 1, -1, FormatType.JSON, "", "")).foreach { implicit arguments => 109 | implicit val generatorConfig: DataGeneratorConfig = DataGeneratorConfig(arguments.brokers, arguments.schemaRegistry, arguments.produceDelay, arguments.defaultSchemaRegistry) 110 | 111 | CreateTopicFn(arguments.topic, arguments.partitions, arguments.replication) 112 | val generator = generators(arguments.dataSet) 113 | arguments.format match { 114 | case FormatType.AVRO => generator.avro(arguments.topic) 115 | case FormatType.JSON => generator.json(arguments.topic) 116 | case FormatType.XML => generator.xml(arguments.topic) 117 | case FormatType.PROTO => generator.protobuf(arguments.topic) 118 | } 119 | } 120 | 121 | } 122 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /datagen-kafka/src/main/java/io/lenses/data/generator/domain/weather/WeatherOuterClass.java: -------------------------------------------------------------------------------- 1 | package io.lenses.data.generator.domain.weather;// Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: weather.proto 3 | 4 | public final class WeatherOuterClass { 5 | private WeatherOuterClass() {} 6 | public static void registerAllExtensions( 7 | com.google.protobuf.ExtensionRegistryLite registry) { 8 | } 9 | 10 | public static void registerAllExtensions( 11 | com.google.protobuf.ExtensionRegistry registry) { 12 | registerAllExtensions( 13 | (com.google.protobuf.ExtensionRegistryLite) registry); 14 | } 15 | public interface WindOrBuilder extends 16 | // @@protoc_insertion_point(interface_extends:Wind) 17 | com.google.protobuf.MessageOrBuilder { 18 | 19 | /** 20 | * int32 chill = 1; 21 | */ 22 | int getChill(); 23 | 24 | /** 25 | * int32 direction = 2; 26 | */ 27 | int getDirection(); 28 | 29 | /** 30 | * int32 speed = 3; 31 | */ 32 | int getSpeed(); 33 | } 34 | /** 35 | * Protobuf type {@code Wind} 36 | */ 37 | public static final class Wind extends 38 | com.google.protobuf.GeneratedMessageV3 implements 39 | // @@protoc_insertion_point(message_implements:Wind) 40 | WindOrBuilder { 41 | private static final long serialVersionUID = 0L; 42 | // Use Wind.newBuilder() to construct. 43 | private Wind(com.google.protobuf.GeneratedMessageV3.Builder builder) { 44 | super(builder); 45 | } 46 | private Wind() { 47 | chill_ = 0; 48 | direction_ = 0; 49 | speed_ = 0; 50 | } 51 | 52 | @java.lang.Override 53 | public final com.google.protobuf.UnknownFieldSet 54 | getUnknownFields() { 55 | return this.unknownFields; 56 | } 57 | private Wind( 58 | com.google.protobuf.CodedInputStream input, 59 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 60 | throws com.google.protobuf.InvalidProtocolBufferException { 61 | this(); 62 | if (extensionRegistry == null) { 63 | throw new java.lang.NullPointerException(); 64 | } 65 | int mutable_bitField0_ = 0; 66 | com.google.protobuf.UnknownFieldSet.Builder unknownFields = 67 | com.google.protobuf.UnknownFieldSet.newBuilder(); 68 | try { 69 | boolean done = false; 70 | while (!done) { 71 | int tag = input.readTag(); 72 | switch (tag) { 73 | case 0: 74 | done = true; 75 | break; 76 | default: { 77 | if (!parseUnknownFieldProto3( 78 | input, unknownFields, extensionRegistry, tag)) { 79 | done = true; 80 | } 81 | break; 82 | } 83 | case 8: { 84 | 85 | chill_ = input.readInt32(); 86 | break; 87 | } 88 | case 16: { 89 | 90 | direction_ = input.readInt32(); 91 | break; 92 | } 93 | case 24: { 94 | 95 | speed_ = input.readInt32(); 96 | break; 97 | } 98 | } 99 | } 100 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 101 | throw e.setUnfinishedMessage(this); 102 | } catch (java.io.IOException e) { 103 | throw new com.google.protobuf.InvalidProtocolBufferException( 104 | e).setUnfinishedMessage(this); 105 | } finally { 106 | this.unknownFields = unknownFields.build(); 107 | makeExtensionsImmutable(); 108 | } 109 | } 110 | public static final com.google.protobuf.Descriptors.Descriptor 111 | getDescriptor() { 112 | return WeatherOuterClass.internal_static_Wind_descriptor; 113 | } 114 | 115 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 116 | internalGetFieldAccessorTable() { 117 | return WeatherOuterClass.internal_static_Wind_fieldAccessorTable 118 | .ensureFieldAccessorsInitialized( 119 | WeatherOuterClass.Wind.class, WeatherOuterClass.Wind.Builder.class); 120 | } 121 | 122 | public static final int CHILL_FIELD_NUMBER = 1; 123 | private int chill_; 124 | /** 125 | * int32 chill = 1; 126 | */ 127 | public int getChill() { 128 | return chill_; 129 | } 130 | 131 | public static final int DIRECTION_FIELD_NUMBER = 2; 132 | private int direction_; 133 | /** 134 | * int32 direction = 2; 135 | */ 136 | public int getDirection() { 137 | return direction_; 138 | } 139 | 140 | public static final int SPEED_FIELD_NUMBER = 3; 141 | private int speed_; 142 | /** 143 | * int32 speed = 3; 144 | */ 145 | public int getSpeed() { 146 | return speed_; 147 | } 148 | 149 | private byte memoizedIsInitialized = -1; 150 | public final boolean isInitialized() { 151 | byte isInitialized = memoizedIsInitialized; 152 | if (isInitialized == 1) return true; 153 | if (isInitialized == 0) return false; 154 | 155 | memoizedIsInitialized = 1; 156 | return true; 157 | } 158 | 159 | public void writeTo(com.google.protobuf.CodedOutputStream output) 160 | throws java.io.IOException { 161 | if (chill_ != 0) { 162 | output.writeInt32(1, chill_); 163 | } 164 | if (direction_ != 0) { 165 | output.writeInt32(2, direction_); 166 | } 167 | if (speed_ != 0) { 168 | output.writeInt32(3, speed_); 169 | } 170 | unknownFields.writeTo(output); 171 | } 172 | 173 | public int getSerializedSize() { 174 | int size = memoizedSize; 175 | if (size != -1) return size; 176 | 177 | size = 0; 178 | if (chill_ != 0) { 179 | size += com.google.protobuf.CodedOutputStream 180 | .computeInt32Size(1, chill_); 181 | } 182 | if (direction_ != 0) { 183 | size += com.google.protobuf.CodedOutputStream 184 | .computeInt32Size(2, direction_); 185 | } 186 | if (speed_ != 0) { 187 | size += com.google.protobuf.CodedOutputStream 188 | .computeInt32Size(3, speed_); 189 | } 190 | size += unknownFields.getSerializedSize(); 191 | memoizedSize = size; 192 | return size; 193 | } 194 | 195 | @java.lang.Override 196 | public boolean equals(final java.lang.Object obj) { 197 | if (obj == this) { 198 | return true; 199 | } 200 | if (!(obj instanceof WeatherOuterClass.Wind)) { 201 | return super.equals(obj); 202 | } 203 | WeatherOuterClass.Wind other = (WeatherOuterClass.Wind) obj; 204 | 205 | boolean result = true; 206 | result = result && (getChill() 207 | == other.getChill()); 208 | result = result && (getDirection() 209 | == other.getDirection()); 210 | result = result && (getSpeed() 211 | == other.getSpeed()); 212 | result = result && unknownFields.equals(other.unknownFields); 213 | return result; 214 | } 215 | 216 | @java.lang.Override 217 | public int hashCode() { 218 | if (memoizedHashCode != 0) { 219 | return memoizedHashCode; 220 | } 221 | int hash = 41; 222 | hash = (19 * hash) + getDescriptor().hashCode(); 223 | hash = (37 * hash) + CHILL_FIELD_NUMBER; 224 | hash = (53 * hash) + getChill(); 225 | hash = (37 * hash) + DIRECTION_FIELD_NUMBER; 226 | hash = (53 * hash) + getDirection(); 227 | hash = (37 * hash) + SPEED_FIELD_NUMBER; 228 | hash = (53 * hash) + getSpeed(); 229 | hash = (29 * hash) + unknownFields.hashCode(); 230 | memoizedHashCode = hash; 231 | return hash; 232 | } 233 | 234 | public static WeatherOuterClass.Wind parseFrom( 235 | java.nio.ByteBuffer data) 236 | throws com.google.protobuf.InvalidProtocolBufferException { 237 | return PARSER.parseFrom(data); 238 | } 239 | public static WeatherOuterClass.Wind parseFrom( 240 | java.nio.ByteBuffer data, 241 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 242 | throws com.google.protobuf.InvalidProtocolBufferException { 243 | return PARSER.parseFrom(data, extensionRegistry); 244 | } 245 | public static WeatherOuterClass.Wind parseFrom( 246 | com.google.protobuf.ByteString data) 247 | throws com.google.protobuf.InvalidProtocolBufferException { 248 | return PARSER.parseFrom(data); 249 | } 250 | public static WeatherOuterClass.Wind parseFrom( 251 | com.google.protobuf.ByteString data, 252 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 253 | throws com.google.protobuf.InvalidProtocolBufferException { 254 | return PARSER.parseFrom(data, extensionRegistry); 255 | } 256 | public static WeatherOuterClass.Wind parseFrom(byte[] data) 257 | throws com.google.protobuf.InvalidProtocolBufferException { 258 | return PARSER.parseFrom(data); 259 | } 260 | public static WeatherOuterClass.Wind parseFrom( 261 | byte[] data, 262 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 263 | throws com.google.protobuf.InvalidProtocolBufferException { 264 | return PARSER.parseFrom(data, extensionRegistry); 265 | } 266 | public static WeatherOuterClass.Wind parseFrom(java.io.InputStream input) 267 | throws java.io.IOException { 268 | return com.google.protobuf.GeneratedMessageV3 269 | .parseWithIOException(PARSER, input); 270 | } 271 | public static WeatherOuterClass.Wind parseFrom( 272 | java.io.InputStream input, 273 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 274 | throws java.io.IOException { 275 | return com.google.protobuf.GeneratedMessageV3 276 | .parseWithIOException(PARSER, input, extensionRegistry); 277 | } 278 | public static WeatherOuterClass.Wind parseDelimitedFrom(java.io.InputStream input) 279 | throws java.io.IOException { 280 | return com.google.protobuf.GeneratedMessageV3 281 | .parseDelimitedWithIOException(PARSER, input); 282 | } 283 | public static WeatherOuterClass.Wind parseDelimitedFrom( 284 | java.io.InputStream input, 285 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 286 | throws java.io.IOException { 287 | return com.google.protobuf.GeneratedMessageV3 288 | .parseDelimitedWithIOException(PARSER, input, extensionRegistry); 289 | } 290 | public static WeatherOuterClass.Wind parseFrom( 291 | com.google.protobuf.CodedInputStream input) 292 | throws java.io.IOException { 293 | return com.google.protobuf.GeneratedMessageV3 294 | .parseWithIOException(PARSER, input); 295 | } 296 | public static WeatherOuterClass.Wind parseFrom( 297 | com.google.protobuf.CodedInputStream input, 298 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 299 | throws java.io.IOException { 300 | return com.google.protobuf.GeneratedMessageV3 301 | .parseWithIOException(PARSER, input, extensionRegistry); 302 | } 303 | 304 | public Builder newBuilderForType() { return newBuilder(); } 305 | public static Builder newBuilder() { 306 | return DEFAULT_INSTANCE.toBuilder(); 307 | } 308 | public static Builder newBuilder(WeatherOuterClass.Wind prototype) { 309 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 310 | } 311 | public Builder toBuilder() { 312 | return this == DEFAULT_INSTANCE 313 | ? new Builder() : new Builder().mergeFrom(this); 314 | } 315 | 316 | @java.lang.Override 317 | protected Builder newBuilderForType( 318 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 319 | Builder builder = new Builder(parent); 320 | return builder; 321 | } 322 | /** 323 | * Protobuf type {@code Wind} 324 | */ 325 | public static final class Builder extends 326 | com.google.protobuf.GeneratedMessageV3.Builder implements 327 | // @@protoc_insertion_point(builder_implements:Wind) 328 | WeatherOuterClass.WindOrBuilder { 329 | public static final com.google.protobuf.Descriptors.Descriptor 330 | getDescriptor() { 331 | return WeatherOuterClass.internal_static_Wind_descriptor; 332 | } 333 | 334 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 335 | internalGetFieldAccessorTable() { 336 | return WeatherOuterClass.internal_static_Wind_fieldAccessorTable 337 | .ensureFieldAccessorsInitialized( 338 | WeatherOuterClass.Wind.class, WeatherOuterClass.Wind.Builder.class); 339 | } 340 | 341 | // Construct using WeatherOuterClass.Wind.newBuilder() 342 | private Builder() { 343 | maybeForceBuilderInitialization(); 344 | } 345 | 346 | private Builder( 347 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 348 | super(parent); 349 | maybeForceBuilderInitialization(); 350 | } 351 | private void maybeForceBuilderInitialization() { 352 | if (com.google.protobuf.GeneratedMessageV3 353 | .alwaysUseFieldBuilders) { 354 | } 355 | } 356 | public Builder clear() { 357 | super.clear(); 358 | chill_ = 0; 359 | 360 | direction_ = 0; 361 | 362 | speed_ = 0; 363 | 364 | return this; 365 | } 366 | 367 | public com.google.protobuf.Descriptors.Descriptor 368 | getDescriptorForType() { 369 | return WeatherOuterClass.internal_static_Wind_descriptor; 370 | } 371 | 372 | public WeatherOuterClass.Wind getDefaultInstanceForType() { 373 | return WeatherOuterClass.Wind.getDefaultInstance(); 374 | } 375 | 376 | public WeatherOuterClass.Wind build() { 377 | WeatherOuterClass.Wind result = buildPartial(); 378 | if (!result.isInitialized()) { 379 | throw newUninitializedMessageException(result); 380 | } 381 | return result; 382 | } 383 | 384 | public WeatherOuterClass.Wind buildPartial() { 385 | WeatherOuterClass.Wind result = new WeatherOuterClass.Wind(this); 386 | result.chill_ = chill_; 387 | result.direction_ = direction_; 388 | result.speed_ = speed_; 389 | onBuilt(); 390 | return result; 391 | } 392 | 393 | public Builder clone() { 394 | return (Builder) super.clone(); 395 | } 396 | public Builder setField( 397 | com.google.protobuf.Descriptors.FieldDescriptor field, 398 | java.lang.Object value) { 399 | return (Builder) super.setField(field, value); 400 | } 401 | public Builder clearField( 402 | com.google.protobuf.Descriptors.FieldDescriptor field) { 403 | return (Builder) super.clearField(field); 404 | } 405 | public Builder clearOneof( 406 | com.google.protobuf.Descriptors.OneofDescriptor oneof) { 407 | return (Builder) super.clearOneof(oneof); 408 | } 409 | public Builder setRepeatedField( 410 | com.google.protobuf.Descriptors.FieldDescriptor field, 411 | int index, java.lang.Object value) { 412 | return (Builder) super.setRepeatedField(field, index, value); 413 | } 414 | public Builder addRepeatedField( 415 | com.google.protobuf.Descriptors.FieldDescriptor field, 416 | java.lang.Object value) { 417 | return (Builder) super.addRepeatedField(field, value); 418 | } 419 | public Builder mergeFrom(com.google.protobuf.Message other) { 420 | if (other instanceof WeatherOuterClass.Wind) { 421 | return mergeFrom((WeatherOuterClass.Wind)other); 422 | } else { 423 | super.mergeFrom(other); 424 | return this; 425 | } 426 | } 427 | 428 | public Builder mergeFrom(WeatherOuterClass.Wind other) { 429 | if (other == WeatherOuterClass.Wind.getDefaultInstance()) return this; 430 | if (other.getChill() != 0) { 431 | setChill(other.getChill()); 432 | } 433 | if (other.getDirection() != 0) { 434 | setDirection(other.getDirection()); 435 | } 436 | if (other.getSpeed() != 0) { 437 | setSpeed(other.getSpeed()); 438 | } 439 | this.mergeUnknownFields(other.unknownFields); 440 | onChanged(); 441 | return this; 442 | } 443 | 444 | public final boolean isInitialized() { 445 | return true; 446 | } 447 | 448 | public Builder mergeFrom( 449 | com.google.protobuf.CodedInputStream input, 450 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 451 | throws java.io.IOException { 452 | WeatherOuterClass.Wind parsedMessage = null; 453 | try { 454 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); 455 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 456 | parsedMessage = (WeatherOuterClass.Wind) e.getUnfinishedMessage(); 457 | throw e.unwrapIOException(); 458 | } finally { 459 | if (parsedMessage != null) { 460 | mergeFrom(parsedMessage); 461 | } 462 | } 463 | return this; 464 | } 465 | 466 | private int chill_ ; 467 | /** 468 | * int32 chill = 1; 469 | */ 470 | public int getChill() { 471 | return chill_; 472 | } 473 | /** 474 | * int32 chill = 1; 475 | */ 476 | public Builder setChill(int value) { 477 | 478 | chill_ = value; 479 | onChanged(); 480 | return this; 481 | } 482 | /** 483 | * int32 chill = 1; 484 | */ 485 | public Builder clearChill() { 486 | 487 | chill_ = 0; 488 | onChanged(); 489 | return this; 490 | } 491 | 492 | private int direction_ ; 493 | /** 494 | * int32 direction = 2; 495 | */ 496 | public int getDirection() { 497 | return direction_; 498 | } 499 | /** 500 | * int32 direction = 2; 501 | */ 502 | public Builder setDirection(int value) { 503 | 504 | direction_ = value; 505 | onChanged(); 506 | return this; 507 | } 508 | /** 509 | * int32 direction = 2; 510 | */ 511 | public Builder clearDirection() { 512 | 513 | direction_ = 0; 514 | onChanged(); 515 | return this; 516 | } 517 | 518 | private int speed_ ; 519 | /** 520 | * int32 speed = 3; 521 | */ 522 | public int getSpeed() { 523 | return speed_; 524 | } 525 | /** 526 | * int32 speed = 3; 527 | */ 528 | public Builder setSpeed(int value) { 529 | 530 | speed_ = value; 531 | onChanged(); 532 | return this; 533 | } 534 | /** 535 | * int32 speed = 3; 536 | */ 537 | public Builder clearSpeed() { 538 | 539 | speed_ = 0; 540 | onChanged(); 541 | return this; 542 | } 543 | public final Builder setUnknownFields( 544 | final com.google.protobuf.UnknownFieldSet unknownFields) { 545 | return super.setUnknownFieldsProto3(unknownFields); 546 | } 547 | 548 | public final Builder mergeUnknownFields( 549 | final com.google.protobuf.UnknownFieldSet unknownFields) { 550 | return super.mergeUnknownFields(unknownFields); 551 | } 552 | 553 | 554 | // @@protoc_insertion_point(builder_scope:Wind) 555 | } 556 | 557 | // @@protoc_insertion_point(class_scope:Wind) 558 | private static final WeatherOuterClass.Wind DEFAULT_INSTANCE; 559 | static { 560 | DEFAULT_INSTANCE = new WeatherOuterClass.Wind(); 561 | } 562 | 563 | public static WeatherOuterClass.Wind getDefaultInstance() { 564 | return DEFAULT_INSTANCE; 565 | } 566 | 567 | private static final com.google.protobuf.Parser 568 | PARSER = new com.google.protobuf.AbstractParser() { 569 | public Wind parsePartialFrom( 570 | com.google.protobuf.CodedInputStream input, 571 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 572 | throws com.google.protobuf.InvalidProtocolBufferException { 573 | return new Wind(input, extensionRegistry); 574 | } 575 | }; 576 | 577 | public static com.google.protobuf.Parser parser() { 578 | return PARSER; 579 | } 580 | 581 | @java.lang.Override 582 | public com.google.protobuf.Parser getParserForType() { 583 | return PARSER; 584 | } 585 | 586 | public WeatherOuterClass.Wind getDefaultInstanceForType() { 587 | return DEFAULT_INSTANCE; 588 | } 589 | 590 | } 591 | 592 | public interface AtmosphereOrBuilder extends 593 | // @@protoc_insertion_point(interface_extends:Atmosphere) 594 | com.google.protobuf.MessageOrBuilder { 595 | 596 | /** 597 | * int32 humidity = 1; 598 | */ 599 | int getHumidity(); 600 | 601 | /** 602 | * double pressure = 2; 603 | */ 604 | double getPressure(); 605 | 606 | /** 607 | * int32 rising = 3; 608 | */ 609 | int getRising(); 610 | 611 | /** 612 | * double visibility = 4; 613 | */ 614 | double getVisibility(); 615 | } 616 | /** 617 | * Protobuf type {@code Atmosphere} 618 | */ 619 | public static final class Atmosphere extends 620 | com.google.protobuf.GeneratedMessageV3 implements 621 | // @@protoc_insertion_point(message_implements:Atmosphere) 622 | AtmosphereOrBuilder { 623 | private static final long serialVersionUID = 0L; 624 | // Use Atmosphere.newBuilder() to construct. 625 | private Atmosphere(com.google.protobuf.GeneratedMessageV3.Builder builder) { 626 | super(builder); 627 | } 628 | private Atmosphere() { 629 | humidity_ = 0; 630 | pressure_ = 0D; 631 | rising_ = 0; 632 | visibility_ = 0D; 633 | } 634 | 635 | @java.lang.Override 636 | public final com.google.protobuf.UnknownFieldSet 637 | getUnknownFields() { 638 | return this.unknownFields; 639 | } 640 | private Atmosphere( 641 | com.google.protobuf.CodedInputStream input, 642 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 643 | throws com.google.protobuf.InvalidProtocolBufferException { 644 | this(); 645 | if (extensionRegistry == null) { 646 | throw new java.lang.NullPointerException(); 647 | } 648 | int mutable_bitField0_ = 0; 649 | com.google.protobuf.UnknownFieldSet.Builder unknownFields = 650 | com.google.protobuf.UnknownFieldSet.newBuilder(); 651 | try { 652 | boolean done = false; 653 | while (!done) { 654 | int tag = input.readTag(); 655 | switch (tag) { 656 | case 0: 657 | done = true; 658 | break; 659 | default: { 660 | if (!parseUnknownFieldProto3( 661 | input, unknownFields, extensionRegistry, tag)) { 662 | done = true; 663 | } 664 | break; 665 | } 666 | case 8: { 667 | 668 | humidity_ = input.readInt32(); 669 | break; 670 | } 671 | case 17: { 672 | 673 | pressure_ = input.readDouble(); 674 | break; 675 | } 676 | case 24: { 677 | 678 | rising_ = input.readInt32(); 679 | break; 680 | } 681 | case 33: { 682 | 683 | visibility_ = input.readDouble(); 684 | break; 685 | } 686 | } 687 | } 688 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 689 | throw e.setUnfinishedMessage(this); 690 | } catch (java.io.IOException e) { 691 | throw new com.google.protobuf.InvalidProtocolBufferException( 692 | e).setUnfinishedMessage(this); 693 | } finally { 694 | this.unknownFields = unknownFields.build(); 695 | makeExtensionsImmutable(); 696 | } 697 | } 698 | public static final com.google.protobuf.Descriptors.Descriptor 699 | getDescriptor() { 700 | return WeatherOuterClass.internal_static_Atmosphere_descriptor; 701 | } 702 | 703 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 704 | internalGetFieldAccessorTable() { 705 | return WeatherOuterClass.internal_static_Atmosphere_fieldAccessorTable 706 | .ensureFieldAccessorsInitialized( 707 | WeatherOuterClass.Atmosphere.class, WeatherOuterClass.Atmosphere.Builder.class); 708 | } 709 | 710 | public static final int HUMIDITY_FIELD_NUMBER = 1; 711 | private int humidity_; 712 | /** 713 | * int32 humidity = 1; 714 | */ 715 | public int getHumidity() { 716 | return humidity_; 717 | } 718 | 719 | public static final int PRESSURE_FIELD_NUMBER = 2; 720 | private double pressure_; 721 | /** 722 | * double pressure = 2; 723 | */ 724 | public double getPressure() { 725 | return pressure_; 726 | } 727 | 728 | public static final int RISING_FIELD_NUMBER = 3; 729 | private int rising_; 730 | /** 731 | * int32 rising = 3; 732 | */ 733 | public int getRising() { 734 | return rising_; 735 | } 736 | 737 | public static final int VISIBILITY_FIELD_NUMBER = 4; 738 | private double visibility_; 739 | /** 740 | * double visibility = 4; 741 | */ 742 | public double getVisibility() { 743 | return visibility_; 744 | } 745 | 746 | private byte memoizedIsInitialized = -1; 747 | public final boolean isInitialized() { 748 | byte isInitialized = memoizedIsInitialized; 749 | if (isInitialized == 1) return true; 750 | if (isInitialized == 0) return false; 751 | 752 | memoizedIsInitialized = 1; 753 | return true; 754 | } 755 | 756 | public void writeTo(com.google.protobuf.CodedOutputStream output) 757 | throws java.io.IOException { 758 | if (humidity_ != 0) { 759 | output.writeInt32(1, humidity_); 760 | } 761 | if (pressure_ != 0D) { 762 | output.writeDouble(2, pressure_); 763 | } 764 | if (rising_ != 0) { 765 | output.writeInt32(3, rising_); 766 | } 767 | if (visibility_ != 0D) { 768 | output.writeDouble(4, visibility_); 769 | } 770 | unknownFields.writeTo(output); 771 | } 772 | 773 | public int getSerializedSize() { 774 | int size = memoizedSize; 775 | if (size != -1) return size; 776 | 777 | size = 0; 778 | if (humidity_ != 0) { 779 | size += com.google.protobuf.CodedOutputStream 780 | .computeInt32Size(1, humidity_); 781 | } 782 | if (pressure_ != 0D) { 783 | size += com.google.protobuf.CodedOutputStream 784 | .computeDoubleSize(2, pressure_); 785 | } 786 | if (rising_ != 0) { 787 | size += com.google.protobuf.CodedOutputStream 788 | .computeInt32Size(3, rising_); 789 | } 790 | if (visibility_ != 0D) { 791 | size += com.google.protobuf.CodedOutputStream 792 | .computeDoubleSize(4, visibility_); 793 | } 794 | size += unknownFields.getSerializedSize(); 795 | memoizedSize = size; 796 | return size; 797 | } 798 | 799 | @java.lang.Override 800 | public boolean equals(final java.lang.Object obj) { 801 | if (obj == this) { 802 | return true; 803 | } 804 | if (!(obj instanceof WeatherOuterClass.Atmosphere)) { 805 | return super.equals(obj); 806 | } 807 | WeatherOuterClass.Atmosphere other = (WeatherOuterClass.Atmosphere) obj; 808 | 809 | boolean result = true; 810 | result = result && (getHumidity() 811 | == other.getHumidity()); 812 | result = result && ( 813 | java.lang.Double.doubleToLongBits(getPressure()) 814 | == java.lang.Double.doubleToLongBits( 815 | other.getPressure())); 816 | result = result && (getRising() 817 | == other.getRising()); 818 | result = result && ( 819 | java.lang.Double.doubleToLongBits(getVisibility()) 820 | == java.lang.Double.doubleToLongBits( 821 | other.getVisibility())); 822 | result = result && unknownFields.equals(other.unknownFields); 823 | return result; 824 | } 825 | 826 | @java.lang.Override 827 | public int hashCode() { 828 | if (memoizedHashCode != 0) { 829 | return memoizedHashCode; 830 | } 831 | int hash = 41; 832 | hash = (19 * hash) + getDescriptor().hashCode(); 833 | hash = (37 * hash) + HUMIDITY_FIELD_NUMBER; 834 | hash = (53 * hash) + getHumidity(); 835 | hash = (37 * hash) + PRESSURE_FIELD_NUMBER; 836 | hash = (53 * hash) + com.google.protobuf.Internal.hashLong( 837 | java.lang.Double.doubleToLongBits(getPressure())); 838 | hash = (37 * hash) + RISING_FIELD_NUMBER; 839 | hash = (53 * hash) + getRising(); 840 | hash = (37 * hash) + VISIBILITY_FIELD_NUMBER; 841 | hash = (53 * hash) + com.google.protobuf.Internal.hashLong( 842 | java.lang.Double.doubleToLongBits(getVisibility())); 843 | hash = (29 * hash) + unknownFields.hashCode(); 844 | memoizedHashCode = hash; 845 | return hash; 846 | } 847 | 848 | public static WeatherOuterClass.Atmosphere parseFrom( 849 | java.nio.ByteBuffer data) 850 | throws com.google.protobuf.InvalidProtocolBufferException { 851 | return PARSER.parseFrom(data); 852 | } 853 | public static WeatherOuterClass.Atmosphere parseFrom( 854 | java.nio.ByteBuffer data, 855 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 856 | throws com.google.protobuf.InvalidProtocolBufferException { 857 | return PARSER.parseFrom(data, extensionRegistry); 858 | } 859 | public static WeatherOuterClass.Atmosphere parseFrom( 860 | com.google.protobuf.ByteString data) 861 | throws com.google.protobuf.InvalidProtocolBufferException { 862 | return PARSER.parseFrom(data); 863 | } 864 | public static WeatherOuterClass.Atmosphere parseFrom( 865 | com.google.protobuf.ByteString data, 866 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 867 | throws com.google.protobuf.InvalidProtocolBufferException { 868 | return PARSER.parseFrom(data, extensionRegistry); 869 | } 870 | public static WeatherOuterClass.Atmosphere parseFrom(byte[] data) 871 | throws com.google.protobuf.InvalidProtocolBufferException { 872 | return PARSER.parseFrom(data); 873 | } 874 | public static WeatherOuterClass.Atmosphere parseFrom( 875 | byte[] data, 876 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 877 | throws com.google.protobuf.InvalidProtocolBufferException { 878 | return PARSER.parseFrom(data, extensionRegistry); 879 | } 880 | public static WeatherOuterClass.Atmosphere parseFrom(java.io.InputStream input) 881 | throws java.io.IOException { 882 | return com.google.protobuf.GeneratedMessageV3 883 | .parseWithIOException(PARSER, input); 884 | } 885 | public static WeatherOuterClass.Atmosphere parseFrom( 886 | java.io.InputStream input, 887 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 888 | throws java.io.IOException { 889 | return com.google.protobuf.GeneratedMessageV3 890 | .parseWithIOException(PARSER, input, extensionRegistry); 891 | } 892 | public static WeatherOuterClass.Atmosphere parseDelimitedFrom(java.io.InputStream input) 893 | throws java.io.IOException { 894 | return com.google.protobuf.GeneratedMessageV3 895 | .parseDelimitedWithIOException(PARSER, input); 896 | } 897 | public static WeatherOuterClass.Atmosphere parseDelimitedFrom( 898 | java.io.InputStream input, 899 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 900 | throws java.io.IOException { 901 | return com.google.protobuf.GeneratedMessageV3 902 | .parseDelimitedWithIOException(PARSER, input, extensionRegistry); 903 | } 904 | public static WeatherOuterClass.Atmosphere parseFrom( 905 | com.google.protobuf.CodedInputStream input) 906 | throws java.io.IOException { 907 | return com.google.protobuf.GeneratedMessageV3 908 | .parseWithIOException(PARSER, input); 909 | } 910 | public static WeatherOuterClass.Atmosphere parseFrom( 911 | com.google.protobuf.CodedInputStream input, 912 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 913 | throws java.io.IOException { 914 | return com.google.protobuf.GeneratedMessageV3 915 | .parseWithIOException(PARSER, input, extensionRegistry); 916 | } 917 | 918 | public Builder newBuilderForType() { return newBuilder(); } 919 | public static Builder newBuilder() { 920 | return DEFAULT_INSTANCE.toBuilder(); 921 | } 922 | public static Builder newBuilder(WeatherOuterClass.Atmosphere prototype) { 923 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 924 | } 925 | public Builder toBuilder() { 926 | return this == DEFAULT_INSTANCE 927 | ? new Builder() : new Builder().mergeFrom(this); 928 | } 929 | 930 | @java.lang.Override 931 | protected Builder newBuilderForType( 932 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 933 | Builder builder = new Builder(parent); 934 | return builder; 935 | } 936 | /** 937 | * Protobuf type {@code Atmosphere} 938 | */ 939 | public static final class Builder extends 940 | com.google.protobuf.GeneratedMessageV3.Builder implements 941 | // @@protoc_insertion_point(builder_implements:Atmosphere) 942 | WeatherOuterClass.AtmosphereOrBuilder { 943 | public static final com.google.protobuf.Descriptors.Descriptor 944 | getDescriptor() { 945 | return WeatherOuterClass.internal_static_Atmosphere_descriptor; 946 | } 947 | 948 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 949 | internalGetFieldAccessorTable() { 950 | return WeatherOuterClass.internal_static_Atmosphere_fieldAccessorTable 951 | .ensureFieldAccessorsInitialized( 952 | WeatherOuterClass.Atmosphere.class, WeatherOuterClass.Atmosphere.Builder.class); 953 | } 954 | 955 | // Construct using WeatherOuterClass.Atmosphere.newBuilder() 956 | private Builder() { 957 | maybeForceBuilderInitialization(); 958 | } 959 | 960 | private Builder( 961 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 962 | super(parent); 963 | maybeForceBuilderInitialization(); 964 | } 965 | private void maybeForceBuilderInitialization() { 966 | if (com.google.protobuf.GeneratedMessageV3 967 | .alwaysUseFieldBuilders) { 968 | } 969 | } 970 | public Builder clear() { 971 | super.clear(); 972 | humidity_ = 0; 973 | 974 | pressure_ = 0D; 975 | 976 | rising_ = 0; 977 | 978 | visibility_ = 0D; 979 | 980 | return this; 981 | } 982 | 983 | public com.google.protobuf.Descriptors.Descriptor 984 | getDescriptorForType() { 985 | return WeatherOuterClass.internal_static_Atmosphere_descriptor; 986 | } 987 | 988 | public WeatherOuterClass.Atmosphere getDefaultInstanceForType() { 989 | return WeatherOuterClass.Atmosphere.getDefaultInstance(); 990 | } 991 | 992 | public WeatherOuterClass.Atmosphere build() { 993 | WeatherOuterClass.Atmosphere result = buildPartial(); 994 | if (!result.isInitialized()) { 995 | throw newUninitializedMessageException(result); 996 | } 997 | return result; 998 | } 999 | 1000 | public WeatherOuterClass.Atmosphere buildPartial() { 1001 | WeatherOuterClass.Atmosphere result = new WeatherOuterClass.Atmosphere(this); 1002 | result.humidity_ = humidity_; 1003 | result.pressure_ = pressure_; 1004 | result.rising_ = rising_; 1005 | result.visibility_ = visibility_; 1006 | onBuilt(); 1007 | return result; 1008 | } 1009 | 1010 | public Builder clone() { 1011 | return (Builder) super.clone(); 1012 | } 1013 | public Builder setField( 1014 | com.google.protobuf.Descriptors.FieldDescriptor field, 1015 | java.lang.Object value) { 1016 | return (Builder) super.setField(field, value); 1017 | } 1018 | public Builder clearField( 1019 | com.google.protobuf.Descriptors.FieldDescriptor field) { 1020 | return (Builder) super.clearField(field); 1021 | } 1022 | public Builder clearOneof( 1023 | com.google.protobuf.Descriptors.OneofDescriptor oneof) { 1024 | return (Builder) super.clearOneof(oneof); 1025 | } 1026 | public Builder setRepeatedField( 1027 | com.google.protobuf.Descriptors.FieldDescriptor field, 1028 | int index, java.lang.Object value) { 1029 | return (Builder) super.setRepeatedField(field, index, value); 1030 | } 1031 | public Builder addRepeatedField( 1032 | com.google.protobuf.Descriptors.FieldDescriptor field, 1033 | java.lang.Object value) { 1034 | return (Builder) super.addRepeatedField(field, value); 1035 | } 1036 | public Builder mergeFrom(com.google.protobuf.Message other) { 1037 | if (other instanceof WeatherOuterClass.Atmosphere) { 1038 | return mergeFrom((WeatherOuterClass.Atmosphere)other); 1039 | } else { 1040 | super.mergeFrom(other); 1041 | return this; 1042 | } 1043 | } 1044 | 1045 | public Builder mergeFrom(WeatherOuterClass.Atmosphere other) { 1046 | if (other == WeatherOuterClass.Atmosphere.getDefaultInstance()) return this; 1047 | if (other.getHumidity() != 0) { 1048 | setHumidity(other.getHumidity()); 1049 | } 1050 | if (other.getPressure() != 0D) { 1051 | setPressure(other.getPressure()); 1052 | } 1053 | if (other.getRising() != 0) { 1054 | setRising(other.getRising()); 1055 | } 1056 | if (other.getVisibility() != 0D) { 1057 | setVisibility(other.getVisibility()); 1058 | } 1059 | this.mergeUnknownFields(other.unknownFields); 1060 | onChanged(); 1061 | return this; 1062 | } 1063 | 1064 | public final boolean isInitialized() { 1065 | return true; 1066 | } 1067 | 1068 | public Builder mergeFrom( 1069 | com.google.protobuf.CodedInputStream input, 1070 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1071 | throws java.io.IOException { 1072 | WeatherOuterClass.Atmosphere parsedMessage = null; 1073 | try { 1074 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); 1075 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1076 | parsedMessage = (WeatherOuterClass.Atmosphere) e.getUnfinishedMessage(); 1077 | throw e.unwrapIOException(); 1078 | } finally { 1079 | if (parsedMessage != null) { 1080 | mergeFrom(parsedMessage); 1081 | } 1082 | } 1083 | return this; 1084 | } 1085 | 1086 | private int humidity_ ; 1087 | /** 1088 | * int32 humidity = 1; 1089 | */ 1090 | public int getHumidity() { 1091 | return humidity_; 1092 | } 1093 | /** 1094 | * int32 humidity = 1; 1095 | */ 1096 | public Builder setHumidity(int value) { 1097 | 1098 | humidity_ = value; 1099 | onChanged(); 1100 | return this; 1101 | } 1102 | /** 1103 | * int32 humidity = 1; 1104 | */ 1105 | public Builder clearHumidity() { 1106 | 1107 | humidity_ = 0; 1108 | onChanged(); 1109 | return this; 1110 | } 1111 | 1112 | private double pressure_ ; 1113 | /** 1114 | * double pressure = 2; 1115 | */ 1116 | public double getPressure() { 1117 | return pressure_; 1118 | } 1119 | /** 1120 | * double pressure = 2; 1121 | */ 1122 | public Builder setPressure(double value) { 1123 | 1124 | pressure_ = value; 1125 | onChanged(); 1126 | return this; 1127 | } 1128 | /** 1129 | * double pressure = 2; 1130 | */ 1131 | public Builder clearPressure() { 1132 | 1133 | pressure_ = 0D; 1134 | onChanged(); 1135 | return this; 1136 | } 1137 | 1138 | private int rising_ ; 1139 | /** 1140 | * int32 rising = 3; 1141 | */ 1142 | public int getRising() { 1143 | return rising_; 1144 | } 1145 | /** 1146 | * int32 rising = 3; 1147 | */ 1148 | public Builder setRising(int value) { 1149 | 1150 | rising_ = value; 1151 | onChanged(); 1152 | return this; 1153 | } 1154 | /** 1155 | * int32 rising = 3; 1156 | */ 1157 | public Builder clearRising() { 1158 | 1159 | rising_ = 0; 1160 | onChanged(); 1161 | return this; 1162 | } 1163 | 1164 | private double visibility_ ; 1165 | /** 1166 | * double visibility = 4; 1167 | */ 1168 | public double getVisibility() { 1169 | return visibility_; 1170 | } 1171 | /** 1172 | * double visibility = 4; 1173 | */ 1174 | public Builder setVisibility(double value) { 1175 | 1176 | visibility_ = value; 1177 | onChanged(); 1178 | return this; 1179 | } 1180 | /** 1181 | * double visibility = 4; 1182 | */ 1183 | public Builder clearVisibility() { 1184 | 1185 | visibility_ = 0D; 1186 | onChanged(); 1187 | return this; 1188 | } 1189 | public final Builder setUnknownFields( 1190 | final com.google.protobuf.UnknownFieldSet unknownFields) { 1191 | return super.setUnknownFieldsProto3(unknownFields); 1192 | } 1193 | 1194 | public final Builder mergeUnknownFields( 1195 | final com.google.protobuf.UnknownFieldSet unknownFields) { 1196 | return super.mergeUnknownFields(unknownFields); 1197 | } 1198 | 1199 | 1200 | // @@protoc_insertion_point(builder_scope:Atmosphere) 1201 | } 1202 | 1203 | // @@protoc_insertion_point(class_scope:Atmosphere) 1204 | private static final WeatherOuterClass.Atmosphere DEFAULT_INSTANCE; 1205 | static { 1206 | DEFAULT_INSTANCE = new WeatherOuterClass.Atmosphere(); 1207 | } 1208 | 1209 | public static WeatherOuterClass.Atmosphere getDefaultInstance() { 1210 | return DEFAULT_INSTANCE; 1211 | } 1212 | 1213 | private static final com.google.protobuf.Parser 1214 | PARSER = new com.google.protobuf.AbstractParser() { 1215 | public Atmosphere parsePartialFrom( 1216 | com.google.protobuf.CodedInputStream input, 1217 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1218 | throws com.google.protobuf.InvalidProtocolBufferException { 1219 | return new Atmosphere(input, extensionRegistry); 1220 | } 1221 | }; 1222 | 1223 | public static com.google.protobuf.Parser parser() { 1224 | return PARSER; 1225 | } 1226 | 1227 | @java.lang.Override 1228 | public com.google.protobuf.Parser getParserForType() { 1229 | return PARSER; 1230 | } 1231 | 1232 | public WeatherOuterClass.Atmosphere getDefaultInstanceForType() { 1233 | return DEFAULT_INSTANCE; 1234 | } 1235 | 1236 | } 1237 | 1238 | public interface ForecastOrBuilder extends 1239 | // @@protoc_insertion_point(interface_extends:Forecast) 1240 | com.google.protobuf.MessageOrBuilder { 1241 | 1242 | /** 1243 | * string date = 1; 1244 | */ 1245 | java.lang.String getDate(); 1246 | /** 1247 | * string date = 1; 1248 | */ 1249 | com.google.protobuf.ByteString 1250 | getDateBytes(); 1251 | 1252 | /** 1253 | * string day = 2; 1254 | */ 1255 | java.lang.String getDay(); 1256 | /** 1257 | * string day = 2; 1258 | */ 1259 | com.google.protobuf.ByteString 1260 | getDayBytes(); 1261 | 1262 | /** 1263 | * int32 high = 3; 1264 | */ 1265 | int getHigh(); 1266 | 1267 | /** 1268 | * int32 low = 4; 1269 | */ 1270 | int getLow(); 1271 | 1272 | /** 1273 | * string text = 5; 1274 | */ 1275 | java.lang.String getText(); 1276 | /** 1277 | * string text = 5; 1278 | */ 1279 | com.google.protobuf.ByteString 1280 | getTextBytes(); 1281 | } 1282 | /** 1283 | * Protobuf type {@code Forecast} 1284 | */ 1285 | public static final class Forecast extends 1286 | com.google.protobuf.GeneratedMessageV3 implements 1287 | // @@protoc_insertion_point(message_implements:Forecast) 1288 | ForecastOrBuilder { 1289 | private static final long serialVersionUID = 0L; 1290 | // Use Forecast.newBuilder() to construct. 1291 | private Forecast(com.google.protobuf.GeneratedMessageV3.Builder builder) { 1292 | super(builder); 1293 | } 1294 | private Forecast() { 1295 | date_ = ""; 1296 | day_ = ""; 1297 | high_ = 0; 1298 | low_ = 0; 1299 | text_ = ""; 1300 | } 1301 | 1302 | @java.lang.Override 1303 | public final com.google.protobuf.UnknownFieldSet 1304 | getUnknownFields() { 1305 | return this.unknownFields; 1306 | } 1307 | private Forecast( 1308 | com.google.protobuf.CodedInputStream input, 1309 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1310 | throws com.google.protobuf.InvalidProtocolBufferException { 1311 | this(); 1312 | if (extensionRegistry == null) { 1313 | throw new java.lang.NullPointerException(); 1314 | } 1315 | int mutable_bitField0_ = 0; 1316 | com.google.protobuf.UnknownFieldSet.Builder unknownFields = 1317 | com.google.protobuf.UnknownFieldSet.newBuilder(); 1318 | try { 1319 | boolean done = false; 1320 | while (!done) { 1321 | int tag = input.readTag(); 1322 | switch (tag) { 1323 | case 0: 1324 | done = true; 1325 | break; 1326 | default: { 1327 | if (!parseUnknownFieldProto3( 1328 | input, unknownFields, extensionRegistry, tag)) { 1329 | done = true; 1330 | } 1331 | break; 1332 | } 1333 | case 10: { 1334 | java.lang.String s = input.readStringRequireUtf8(); 1335 | 1336 | date_ = s; 1337 | break; 1338 | } 1339 | case 18: { 1340 | java.lang.String s = input.readStringRequireUtf8(); 1341 | 1342 | day_ = s; 1343 | break; 1344 | } 1345 | case 24: { 1346 | 1347 | high_ = input.readInt32(); 1348 | break; 1349 | } 1350 | case 32: { 1351 | 1352 | low_ = input.readInt32(); 1353 | break; 1354 | } 1355 | case 42: { 1356 | java.lang.String s = input.readStringRequireUtf8(); 1357 | 1358 | text_ = s; 1359 | break; 1360 | } 1361 | } 1362 | } 1363 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1364 | throw e.setUnfinishedMessage(this); 1365 | } catch (java.io.IOException e) { 1366 | throw new com.google.protobuf.InvalidProtocolBufferException( 1367 | e).setUnfinishedMessage(this); 1368 | } finally { 1369 | this.unknownFields = unknownFields.build(); 1370 | makeExtensionsImmutable(); 1371 | } 1372 | } 1373 | public static final com.google.protobuf.Descriptors.Descriptor 1374 | getDescriptor() { 1375 | return WeatherOuterClass.internal_static_Forecast_descriptor; 1376 | } 1377 | 1378 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 1379 | internalGetFieldAccessorTable() { 1380 | return WeatherOuterClass.internal_static_Forecast_fieldAccessorTable 1381 | .ensureFieldAccessorsInitialized( 1382 | WeatherOuterClass.Forecast.class, WeatherOuterClass.Forecast.Builder.class); 1383 | } 1384 | 1385 | public static final int DATE_FIELD_NUMBER = 1; 1386 | private volatile java.lang.Object date_; 1387 | /** 1388 | * string date = 1; 1389 | */ 1390 | public java.lang.String getDate() { 1391 | java.lang.Object ref = date_; 1392 | if (ref instanceof java.lang.String) { 1393 | return (java.lang.String) ref; 1394 | } else { 1395 | com.google.protobuf.ByteString bs = 1396 | (com.google.protobuf.ByteString) ref; 1397 | java.lang.String s = bs.toStringUtf8(); 1398 | date_ = s; 1399 | return s; 1400 | } 1401 | } 1402 | /** 1403 | * string date = 1; 1404 | */ 1405 | public com.google.protobuf.ByteString 1406 | getDateBytes() { 1407 | java.lang.Object ref = date_; 1408 | if (ref instanceof java.lang.String) { 1409 | com.google.protobuf.ByteString b = 1410 | com.google.protobuf.ByteString.copyFromUtf8( 1411 | (java.lang.String) ref); 1412 | date_ = b; 1413 | return b; 1414 | } else { 1415 | return (com.google.protobuf.ByteString) ref; 1416 | } 1417 | } 1418 | 1419 | public static final int DAY_FIELD_NUMBER = 2; 1420 | private volatile java.lang.Object day_; 1421 | /** 1422 | * string day = 2; 1423 | */ 1424 | public java.lang.String getDay() { 1425 | java.lang.Object ref = day_; 1426 | if (ref instanceof java.lang.String) { 1427 | return (java.lang.String) ref; 1428 | } else { 1429 | com.google.protobuf.ByteString bs = 1430 | (com.google.protobuf.ByteString) ref; 1431 | java.lang.String s = bs.toStringUtf8(); 1432 | day_ = s; 1433 | return s; 1434 | } 1435 | } 1436 | /** 1437 | * string day = 2; 1438 | */ 1439 | public com.google.protobuf.ByteString 1440 | getDayBytes() { 1441 | java.lang.Object ref = day_; 1442 | if (ref instanceof java.lang.String) { 1443 | com.google.protobuf.ByteString b = 1444 | com.google.protobuf.ByteString.copyFromUtf8( 1445 | (java.lang.String) ref); 1446 | day_ = b; 1447 | return b; 1448 | } else { 1449 | return (com.google.protobuf.ByteString) ref; 1450 | } 1451 | } 1452 | 1453 | public static final int HIGH_FIELD_NUMBER = 3; 1454 | private int high_; 1455 | /** 1456 | * int32 high = 3; 1457 | */ 1458 | public int getHigh() { 1459 | return high_; 1460 | } 1461 | 1462 | public static final int LOW_FIELD_NUMBER = 4; 1463 | private int low_; 1464 | /** 1465 | * int32 low = 4; 1466 | */ 1467 | public int getLow() { 1468 | return low_; 1469 | } 1470 | 1471 | public static final int TEXT_FIELD_NUMBER = 5; 1472 | private volatile java.lang.Object text_; 1473 | /** 1474 | * string text = 5; 1475 | */ 1476 | public java.lang.String getText() { 1477 | java.lang.Object ref = text_; 1478 | if (ref instanceof java.lang.String) { 1479 | return (java.lang.String) ref; 1480 | } else { 1481 | com.google.protobuf.ByteString bs = 1482 | (com.google.protobuf.ByteString) ref; 1483 | java.lang.String s = bs.toStringUtf8(); 1484 | text_ = s; 1485 | return s; 1486 | } 1487 | } 1488 | /** 1489 | * string text = 5; 1490 | */ 1491 | public com.google.protobuf.ByteString 1492 | getTextBytes() { 1493 | java.lang.Object ref = text_; 1494 | if (ref instanceof java.lang.String) { 1495 | com.google.protobuf.ByteString b = 1496 | com.google.protobuf.ByteString.copyFromUtf8( 1497 | (java.lang.String) ref); 1498 | text_ = b; 1499 | return b; 1500 | } else { 1501 | return (com.google.protobuf.ByteString) ref; 1502 | } 1503 | } 1504 | 1505 | private byte memoizedIsInitialized = -1; 1506 | public final boolean isInitialized() { 1507 | byte isInitialized = memoizedIsInitialized; 1508 | if (isInitialized == 1) return true; 1509 | if (isInitialized == 0) return false; 1510 | 1511 | memoizedIsInitialized = 1; 1512 | return true; 1513 | } 1514 | 1515 | public void writeTo(com.google.protobuf.CodedOutputStream output) 1516 | throws java.io.IOException { 1517 | if (!getDateBytes().isEmpty()) { 1518 | com.google.protobuf.GeneratedMessageV3.writeString(output, 1, date_); 1519 | } 1520 | if (!getDayBytes().isEmpty()) { 1521 | com.google.protobuf.GeneratedMessageV3.writeString(output, 2, day_); 1522 | } 1523 | if (high_ != 0) { 1524 | output.writeInt32(3, high_); 1525 | } 1526 | if (low_ != 0) { 1527 | output.writeInt32(4, low_); 1528 | } 1529 | if (!getTextBytes().isEmpty()) { 1530 | com.google.protobuf.GeneratedMessageV3.writeString(output, 5, text_); 1531 | } 1532 | unknownFields.writeTo(output); 1533 | } 1534 | 1535 | public int getSerializedSize() { 1536 | int size = memoizedSize; 1537 | if (size != -1) return size; 1538 | 1539 | size = 0; 1540 | if (!getDateBytes().isEmpty()) { 1541 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, date_); 1542 | } 1543 | if (!getDayBytes().isEmpty()) { 1544 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, day_); 1545 | } 1546 | if (high_ != 0) { 1547 | size += com.google.protobuf.CodedOutputStream 1548 | .computeInt32Size(3, high_); 1549 | } 1550 | if (low_ != 0) { 1551 | size += com.google.protobuf.CodedOutputStream 1552 | .computeInt32Size(4, low_); 1553 | } 1554 | if (!getTextBytes().isEmpty()) { 1555 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, text_); 1556 | } 1557 | size += unknownFields.getSerializedSize(); 1558 | memoizedSize = size; 1559 | return size; 1560 | } 1561 | 1562 | @java.lang.Override 1563 | public boolean equals(final java.lang.Object obj) { 1564 | if (obj == this) { 1565 | return true; 1566 | } 1567 | if (!(obj instanceof WeatherOuterClass.Forecast)) { 1568 | return super.equals(obj); 1569 | } 1570 | WeatherOuterClass.Forecast other = (WeatherOuterClass.Forecast) obj; 1571 | 1572 | boolean result = true; 1573 | result = result && getDate() 1574 | .equals(other.getDate()); 1575 | result = result && getDay() 1576 | .equals(other.getDay()); 1577 | result = result && (getHigh() 1578 | == other.getHigh()); 1579 | result = result && (getLow() 1580 | == other.getLow()); 1581 | result = result && getText() 1582 | .equals(other.getText()); 1583 | result = result && unknownFields.equals(other.unknownFields); 1584 | return result; 1585 | } 1586 | 1587 | @java.lang.Override 1588 | public int hashCode() { 1589 | if (memoizedHashCode != 0) { 1590 | return memoizedHashCode; 1591 | } 1592 | int hash = 41; 1593 | hash = (19 * hash) + getDescriptor().hashCode(); 1594 | hash = (37 * hash) + DATE_FIELD_NUMBER; 1595 | hash = (53 * hash) + getDate().hashCode(); 1596 | hash = (37 * hash) + DAY_FIELD_NUMBER; 1597 | hash = (53 * hash) + getDay().hashCode(); 1598 | hash = (37 * hash) + HIGH_FIELD_NUMBER; 1599 | hash = (53 * hash) + getHigh(); 1600 | hash = (37 * hash) + LOW_FIELD_NUMBER; 1601 | hash = (53 * hash) + getLow(); 1602 | hash = (37 * hash) + TEXT_FIELD_NUMBER; 1603 | hash = (53 * hash) + getText().hashCode(); 1604 | hash = (29 * hash) + unknownFields.hashCode(); 1605 | memoizedHashCode = hash; 1606 | return hash; 1607 | } 1608 | 1609 | public static WeatherOuterClass.Forecast parseFrom( 1610 | java.nio.ByteBuffer data) 1611 | throws com.google.protobuf.InvalidProtocolBufferException { 1612 | return PARSER.parseFrom(data); 1613 | } 1614 | public static WeatherOuterClass.Forecast parseFrom( 1615 | java.nio.ByteBuffer data, 1616 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1617 | throws com.google.protobuf.InvalidProtocolBufferException { 1618 | return PARSER.parseFrom(data, extensionRegistry); 1619 | } 1620 | public static WeatherOuterClass.Forecast parseFrom( 1621 | com.google.protobuf.ByteString data) 1622 | throws com.google.protobuf.InvalidProtocolBufferException { 1623 | return PARSER.parseFrom(data); 1624 | } 1625 | public static WeatherOuterClass.Forecast parseFrom( 1626 | com.google.protobuf.ByteString data, 1627 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1628 | throws com.google.protobuf.InvalidProtocolBufferException { 1629 | return PARSER.parseFrom(data, extensionRegistry); 1630 | } 1631 | public static WeatherOuterClass.Forecast parseFrom(byte[] data) 1632 | throws com.google.protobuf.InvalidProtocolBufferException { 1633 | return PARSER.parseFrom(data); 1634 | } 1635 | public static WeatherOuterClass.Forecast parseFrom( 1636 | byte[] data, 1637 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1638 | throws com.google.protobuf.InvalidProtocolBufferException { 1639 | return PARSER.parseFrom(data, extensionRegistry); 1640 | } 1641 | public static WeatherOuterClass.Forecast parseFrom(java.io.InputStream input) 1642 | throws java.io.IOException { 1643 | return com.google.protobuf.GeneratedMessageV3 1644 | .parseWithIOException(PARSER, input); 1645 | } 1646 | public static WeatherOuterClass.Forecast parseFrom( 1647 | java.io.InputStream input, 1648 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1649 | throws java.io.IOException { 1650 | return com.google.protobuf.GeneratedMessageV3 1651 | .parseWithIOException(PARSER, input, extensionRegistry); 1652 | } 1653 | public static WeatherOuterClass.Forecast parseDelimitedFrom(java.io.InputStream input) 1654 | throws java.io.IOException { 1655 | return com.google.protobuf.GeneratedMessageV3 1656 | .parseDelimitedWithIOException(PARSER, input); 1657 | } 1658 | public static WeatherOuterClass.Forecast parseDelimitedFrom( 1659 | java.io.InputStream input, 1660 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1661 | throws java.io.IOException { 1662 | return com.google.protobuf.GeneratedMessageV3 1663 | .parseDelimitedWithIOException(PARSER, input, extensionRegistry); 1664 | } 1665 | public static WeatherOuterClass.Forecast parseFrom( 1666 | com.google.protobuf.CodedInputStream input) 1667 | throws java.io.IOException { 1668 | return com.google.protobuf.GeneratedMessageV3 1669 | .parseWithIOException(PARSER, input); 1670 | } 1671 | public static WeatherOuterClass.Forecast parseFrom( 1672 | com.google.protobuf.CodedInputStream input, 1673 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1674 | throws java.io.IOException { 1675 | return com.google.protobuf.GeneratedMessageV3 1676 | .parseWithIOException(PARSER, input, extensionRegistry); 1677 | } 1678 | 1679 | public Builder newBuilderForType() { return newBuilder(); } 1680 | public static Builder newBuilder() { 1681 | return DEFAULT_INSTANCE.toBuilder(); 1682 | } 1683 | public static Builder newBuilder(WeatherOuterClass.Forecast prototype) { 1684 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 1685 | } 1686 | public Builder toBuilder() { 1687 | return this == DEFAULT_INSTANCE 1688 | ? new Builder() : new Builder().mergeFrom(this); 1689 | } 1690 | 1691 | @java.lang.Override 1692 | protected Builder newBuilderForType( 1693 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 1694 | Builder builder = new Builder(parent); 1695 | return builder; 1696 | } 1697 | /** 1698 | * Protobuf type {@code Forecast} 1699 | */ 1700 | public static final class Builder extends 1701 | com.google.protobuf.GeneratedMessageV3.Builder implements 1702 | // @@protoc_insertion_point(builder_implements:Forecast) 1703 | WeatherOuterClass.ForecastOrBuilder { 1704 | public static final com.google.protobuf.Descriptors.Descriptor 1705 | getDescriptor() { 1706 | return WeatherOuterClass.internal_static_Forecast_descriptor; 1707 | } 1708 | 1709 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 1710 | internalGetFieldAccessorTable() { 1711 | return WeatherOuterClass.internal_static_Forecast_fieldAccessorTable 1712 | .ensureFieldAccessorsInitialized( 1713 | WeatherOuterClass.Forecast.class, WeatherOuterClass.Forecast.Builder.class); 1714 | } 1715 | 1716 | // Construct using WeatherOuterClass.Forecast.newBuilder() 1717 | private Builder() { 1718 | maybeForceBuilderInitialization(); 1719 | } 1720 | 1721 | private Builder( 1722 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 1723 | super(parent); 1724 | maybeForceBuilderInitialization(); 1725 | } 1726 | private void maybeForceBuilderInitialization() { 1727 | if (com.google.protobuf.GeneratedMessageV3 1728 | .alwaysUseFieldBuilders) { 1729 | } 1730 | } 1731 | public Builder clear() { 1732 | super.clear(); 1733 | date_ = ""; 1734 | 1735 | day_ = ""; 1736 | 1737 | high_ = 0; 1738 | 1739 | low_ = 0; 1740 | 1741 | text_ = ""; 1742 | 1743 | return this; 1744 | } 1745 | 1746 | public com.google.protobuf.Descriptors.Descriptor 1747 | getDescriptorForType() { 1748 | return WeatherOuterClass.internal_static_Forecast_descriptor; 1749 | } 1750 | 1751 | public WeatherOuterClass.Forecast getDefaultInstanceForType() { 1752 | return WeatherOuterClass.Forecast.getDefaultInstance(); 1753 | } 1754 | 1755 | public WeatherOuterClass.Forecast build() { 1756 | WeatherOuterClass.Forecast result = buildPartial(); 1757 | if (!result.isInitialized()) { 1758 | throw newUninitializedMessageException(result); 1759 | } 1760 | return result; 1761 | } 1762 | 1763 | public WeatherOuterClass.Forecast buildPartial() { 1764 | WeatherOuterClass.Forecast result = new WeatherOuterClass.Forecast(this); 1765 | result.date_ = date_; 1766 | result.day_ = day_; 1767 | result.high_ = high_; 1768 | result.low_ = low_; 1769 | result.text_ = text_; 1770 | onBuilt(); 1771 | return result; 1772 | } 1773 | 1774 | public Builder clone() { 1775 | return (Builder) super.clone(); 1776 | } 1777 | public Builder setField( 1778 | com.google.protobuf.Descriptors.FieldDescriptor field, 1779 | java.lang.Object value) { 1780 | return (Builder) super.setField(field, value); 1781 | } 1782 | public Builder clearField( 1783 | com.google.protobuf.Descriptors.FieldDescriptor field) { 1784 | return (Builder) super.clearField(field); 1785 | } 1786 | public Builder clearOneof( 1787 | com.google.protobuf.Descriptors.OneofDescriptor oneof) { 1788 | return (Builder) super.clearOneof(oneof); 1789 | } 1790 | public Builder setRepeatedField( 1791 | com.google.protobuf.Descriptors.FieldDescriptor field, 1792 | int index, java.lang.Object value) { 1793 | return (Builder) super.setRepeatedField(field, index, value); 1794 | } 1795 | public Builder addRepeatedField( 1796 | com.google.protobuf.Descriptors.FieldDescriptor field, 1797 | java.lang.Object value) { 1798 | return (Builder) super.addRepeatedField(field, value); 1799 | } 1800 | public Builder mergeFrom(com.google.protobuf.Message other) { 1801 | if (other instanceof WeatherOuterClass.Forecast) { 1802 | return mergeFrom((WeatherOuterClass.Forecast)other); 1803 | } else { 1804 | super.mergeFrom(other); 1805 | return this; 1806 | } 1807 | } 1808 | 1809 | public Builder mergeFrom(WeatherOuterClass.Forecast other) { 1810 | if (other == WeatherOuterClass.Forecast.getDefaultInstance()) return this; 1811 | if (!other.getDate().isEmpty()) { 1812 | date_ = other.date_; 1813 | onChanged(); 1814 | } 1815 | if (!other.getDay().isEmpty()) { 1816 | day_ = other.day_; 1817 | onChanged(); 1818 | } 1819 | if (other.getHigh() != 0) { 1820 | setHigh(other.getHigh()); 1821 | } 1822 | if (other.getLow() != 0) { 1823 | setLow(other.getLow()); 1824 | } 1825 | if (!other.getText().isEmpty()) { 1826 | text_ = other.text_; 1827 | onChanged(); 1828 | } 1829 | this.mergeUnknownFields(other.unknownFields); 1830 | onChanged(); 1831 | return this; 1832 | } 1833 | 1834 | public final boolean isInitialized() { 1835 | return true; 1836 | } 1837 | 1838 | public Builder mergeFrom( 1839 | com.google.protobuf.CodedInputStream input, 1840 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1841 | throws java.io.IOException { 1842 | WeatherOuterClass.Forecast parsedMessage = null; 1843 | try { 1844 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); 1845 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1846 | parsedMessage = (WeatherOuterClass.Forecast) e.getUnfinishedMessage(); 1847 | throw e.unwrapIOException(); 1848 | } finally { 1849 | if (parsedMessage != null) { 1850 | mergeFrom(parsedMessage); 1851 | } 1852 | } 1853 | return this; 1854 | } 1855 | 1856 | private java.lang.Object date_ = ""; 1857 | /** 1858 | * string date = 1; 1859 | */ 1860 | public java.lang.String getDate() { 1861 | java.lang.Object ref = date_; 1862 | if (!(ref instanceof java.lang.String)) { 1863 | com.google.protobuf.ByteString bs = 1864 | (com.google.protobuf.ByteString) ref; 1865 | java.lang.String s = bs.toStringUtf8(); 1866 | date_ = s; 1867 | return s; 1868 | } else { 1869 | return (java.lang.String) ref; 1870 | } 1871 | } 1872 | /** 1873 | * string date = 1; 1874 | */ 1875 | public com.google.protobuf.ByteString 1876 | getDateBytes() { 1877 | java.lang.Object ref = date_; 1878 | if (ref instanceof String) { 1879 | com.google.protobuf.ByteString b = 1880 | com.google.protobuf.ByteString.copyFromUtf8( 1881 | (java.lang.String) ref); 1882 | date_ = b; 1883 | return b; 1884 | } else { 1885 | return (com.google.protobuf.ByteString) ref; 1886 | } 1887 | } 1888 | /** 1889 | * string date = 1; 1890 | */ 1891 | public Builder setDate( 1892 | java.lang.String value) { 1893 | if (value == null) { 1894 | throw new NullPointerException(); 1895 | } 1896 | 1897 | date_ = value; 1898 | onChanged(); 1899 | return this; 1900 | } 1901 | /** 1902 | * string date = 1; 1903 | */ 1904 | public Builder clearDate() { 1905 | 1906 | date_ = getDefaultInstance().getDate(); 1907 | onChanged(); 1908 | return this; 1909 | } 1910 | /** 1911 | * string date = 1; 1912 | */ 1913 | public Builder setDateBytes( 1914 | com.google.protobuf.ByteString value) { 1915 | if (value == null) { 1916 | throw new NullPointerException(); 1917 | } 1918 | checkByteStringIsUtf8(value); 1919 | 1920 | date_ = value; 1921 | onChanged(); 1922 | return this; 1923 | } 1924 | 1925 | private java.lang.Object day_ = ""; 1926 | /** 1927 | * string day = 2; 1928 | */ 1929 | public java.lang.String getDay() { 1930 | java.lang.Object ref = day_; 1931 | if (!(ref instanceof java.lang.String)) { 1932 | com.google.protobuf.ByteString bs = 1933 | (com.google.protobuf.ByteString) ref; 1934 | java.lang.String s = bs.toStringUtf8(); 1935 | day_ = s; 1936 | return s; 1937 | } else { 1938 | return (java.lang.String) ref; 1939 | } 1940 | } 1941 | /** 1942 | * string day = 2; 1943 | */ 1944 | public com.google.protobuf.ByteString 1945 | getDayBytes() { 1946 | java.lang.Object ref = day_; 1947 | if (ref instanceof String) { 1948 | com.google.protobuf.ByteString b = 1949 | com.google.protobuf.ByteString.copyFromUtf8( 1950 | (java.lang.String) ref); 1951 | day_ = b; 1952 | return b; 1953 | } else { 1954 | return (com.google.protobuf.ByteString) ref; 1955 | } 1956 | } 1957 | /** 1958 | * string day = 2; 1959 | */ 1960 | public Builder setDay( 1961 | java.lang.String value) { 1962 | if (value == null) { 1963 | throw new NullPointerException(); 1964 | } 1965 | 1966 | day_ = value; 1967 | onChanged(); 1968 | return this; 1969 | } 1970 | /** 1971 | * string day = 2; 1972 | */ 1973 | public Builder clearDay() { 1974 | 1975 | day_ = getDefaultInstance().getDay(); 1976 | onChanged(); 1977 | return this; 1978 | } 1979 | /** 1980 | * string day = 2; 1981 | */ 1982 | public Builder setDayBytes( 1983 | com.google.protobuf.ByteString value) { 1984 | if (value == null) { 1985 | throw new NullPointerException(); 1986 | } 1987 | checkByteStringIsUtf8(value); 1988 | 1989 | day_ = value; 1990 | onChanged(); 1991 | return this; 1992 | } 1993 | 1994 | private int high_ ; 1995 | /** 1996 | * int32 high = 3; 1997 | */ 1998 | public int getHigh() { 1999 | return high_; 2000 | } 2001 | /** 2002 | * int32 high = 3; 2003 | */ 2004 | public Builder setHigh(int value) { 2005 | 2006 | high_ = value; 2007 | onChanged(); 2008 | return this; 2009 | } 2010 | /** 2011 | * int32 high = 3; 2012 | */ 2013 | public Builder clearHigh() { 2014 | 2015 | high_ = 0; 2016 | onChanged(); 2017 | return this; 2018 | } 2019 | 2020 | private int low_ ; 2021 | /** 2022 | * int32 low = 4; 2023 | */ 2024 | public int getLow() { 2025 | return low_; 2026 | } 2027 | /** 2028 | * int32 low = 4; 2029 | */ 2030 | public Builder setLow(int value) { 2031 | 2032 | low_ = value; 2033 | onChanged(); 2034 | return this; 2035 | } 2036 | /** 2037 | * int32 low = 4; 2038 | */ 2039 | public Builder clearLow() { 2040 | 2041 | low_ = 0; 2042 | onChanged(); 2043 | return this; 2044 | } 2045 | 2046 | private java.lang.Object text_ = ""; 2047 | /** 2048 | * string text = 5; 2049 | */ 2050 | public java.lang.String getText() { 2051 | java.lang.Object ref = text_; 2052 | if (!(ref instanceof java.lang.String)) { 2053 | com.google.protobuf.ByteString bs = 2054 | (com.google.protobuf.ByteString) ref; 2055 | java.lang.String s = bs.toStringUtf8(); 2056 | text_ = s; 2057 | return s; 2058 | } else { 2059 | return (java.lang.String) ref; 2060 | } 2061 | } 2062 | /** 2063 | * string text = 5; 2064 | */ 2065 | public com.google.protobuf.ByteString 2066 | getTextBytes() { 2067 | java.lang.Object ref = text_; 2068 | if (ref instanceof String) { 2069 | com.google.protobuf.ByteString b = 2070 | com.google.protobuf.ByteString.copyFromUtf8( 2071 | (java.lang.String) ref); 2072 | text_ = b; 2073 | return b; 2074 | } else { 2075 | return (com.google.protobuf.ByteString) ref; 2076 | } 2077 | } 2078 | /** 2079 | * string text = 5; 2080 | */ 2081 | public Builder setText( 2082 | java.lang.String value) { 2083 | if (value == null) { 2084 | throw new NullPointerException(); 2085 | } 2086 | 2087 | text_ = value; 2088 | onChanged(); 2089 | return this; 2090 | } 2091 | /** 2092 | * string text = 5; 2093 | */ 2094 | public Builder clearText() { 2095 | 2096 | text_ = getDefaultInstance().getText(); 2097 | onChanged(); 2098 | return this; 2099 | } 2100 | /** 2101 | * string text = 5; 2102 | */ 2103 | public Builder setTextBytes( 2104 | com.google.protobuf.ByteString value) { 2105 | if (value == null) { 2106 | throw new NullPointerException(); 2107 | } 2108 | checkByteStringIsUtf8(value); 2109 | 2110 | text_ = value; 2111 | onChanged(); 2112 | return this; 2113 | } 2114 | public final Builder setUnknownFields( 2115 | final com.google.protobuf.UnknownFieldSet unknownFields) { 2116 | return super.setUnknownFieldsProto3(unknownFields); 2117 | } 2118 | 2119 | public final Builder mergeUnknownFields( 2120 | final com.google.protobuf.UnknownFieldSet unknownFields) { 2121 | return super.mergeUnknownFields(unknownFields); 2122 | } 2123 | 2124 | 2125 | // @@protoc_insertion_point(builder_scope:Forecast) 2126 | } 2127 | 2128 | // @@protoc_insertion_point(class_scope:Forecast) 2129 | private static final WeatherOuterClass.Forecast DEFAULT_INSTANCE; 2130 | static { 2131 | DEFAULT_INSTANCE = new WeatherOuterClass.Forecast(); 2132 | } 2133 | 2134 | public static WeatherOuterClass.Forecast getDefaultInstance() { 2135 | return DEFAULT_INSTANCE; 2136 | } 2137 | 2138 | private static final com.google.protobuf.Parser 2139 | PARSER = new com.google.protobuf.AbstractParser() { 2140 | public Forecast parsePartialFrom( 2141 | com.google.protobuf.CodedInputStream input, 2142 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2143 | throws com.google.protobuf.InvalidProtocolBufferException { 2144 | return new Forecast(input, extensionRegistry); 2145 | } 2146 | }; 2147 | 2148 | public static com.google.protobuf.Parser parser() { 2149 | return PARSER; 2150 | } 2151 | 2152 | @java.lang.Override 2153 | public com.google.protobuf.Parser getParserForType() { 2154 | return PARSER; 2155 | } 2156 | 2157 | public WeatherOuterClass.Forecast getDefaultInstanceForType() { 2158 | return DEFAULT_INSTANCE; 2159 | } 2160 | 2161 | } 2162 | 2163 | public interface WeatherOrBuilder extends 2164 | // @@protoc_insertion_point(interface_extends:Weather) 2165 | com.google.protobuf.MessageOrBuilder { 2166 | 2167 | /** 2168 | * .Wind wind = 1; 2169 | */ 2170 | boolean hasWind(); 2171 | /** 2172 | * .Wind wind = 1; 2173 | */ 2174 | WeatherOuterClass.Wind getWind(); 2175 | /** 2176 | * .Wind wind = 1; 2177 | */ 2178 | WeatherOuterClass.WindOrBuilder getWindOrBuilder(); 2179 | 2180 | /** 2181 | * .Atmosphere atmosphere = 2; 2182 | */ 2183 | boolean hasAtmosphere(); 2184 | /** 2185 | * .Atmosphere atmosphere = 2; 2186 | */ 2187 | WeatherOuterClass.Atmosphere getAtmosphere(); 2188 | /** 2189 | * .Atmosphere atmosphere = 2; 2190 | */ 2191 | WeatherOuterClass.AtmosphereOrBuilder getAtmosphereOrBuilder(); 2192 | 2193 | /** 2194 | * repeated .Forecast forecast = 3; 2195 | */ 2196 | java.util.List 2197 | getForecastList(); 2198 | /** 2199 | * repeated .Forecast forecast = 3; 2200 | */ 2201 | WeatherOuterClass.Forecast getForecast(int index); 2202 | /** 2203 | * repeated .Forecast forecast = 3; 2204 | */ 2205 | int getForecastCount(); 2206 | /** 2207 | * repeated .Forecast forecast = 3; 2208 | */ 2209 | java.util.List 2210 | getForecastOrBuilderList(); 2211 | /** 2212 | * repeated .Forecast forecast = 3; 2213 | */ 2214 | WeatherOuterClass.ForecastOrBuilder getForecastOrBuilder( 2215 | int index); 2216 | } 2217 | /** 2218 | * Protobuf type {@code Weather} 2219 | */ 2220 | public static final class Weather extends 2221 | com.google.protobuf.GeneratedMessageV3 implements 2222 | // @@protoc_insertion_point(message_implements:Weather) 2223 | WeatherOrBuilder { 2224 | private static final long serialVersionUID = 0L; 2225 | // Use Weather.newBuilder() to construct. 2226 | private Weather(com.google.protobuf.GeneratedMessageV3.Builder builder) { 2227 | super(builder); 2228 | } 2229 | private Weather() { 2230 | forecast_ = java.util.Collections.emptyList(); 2231 | } 2232 | 2233 | @java.lang.Override 2234 | public final com.google.protobuf.UnknownFieldSet 2235 | getUnknownFields() { 2236 | return this.unknownFields; 2237 | } 2238 | private Weather( 2239 | com.google.protobuf.CodedInputStream input, 2240 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2241 | throws com.google.protobuf.InvalidProtocolBufferException { 2242 | this(); 2243 | if (extensionRegistry == null) { 2244 | throw new java.lang.NullPointerException(); 2245 | } 2246 | int mutable_bitField0_ = 0; 2247 | com.google.protobuf.UnknownFieldSet.Builder unknownFields = 2248 | com.google.protobuf.UnknownFieldSet.newBuilder(); 2249 | try { 2250 | boolean done = false; 2251 | while (!done) { 2252 | int tag = input.readTag(); 2253 | switch (tag) { 2254 | case 0: 2255 | done = true; 2256 | break; 2257 | default: { 2258 | if (!parseUnknownFieldProto3( 2259 | input, unknownFields, extensionRegistry, tag)) { 2260 | done = true; 2261 | } 2262 | break; 2263 | } 2264 | case 10: { 2265 | WeatherOuterClass.Wind.Builder subBuilder = null; 2266 | if (wind_ != null) { 2267 | subBuilder = wind_.toBuilder(); 2268 | } 2269 | wind_ = input.readMessage(WeatherOuterClass.Wind.parser(), extensionRegistry); 2270 | if (subBuilder != null) { 2271 | subBuilder.mergeFrom(wind_); 2272 | wind_ = subBuilder.buildPartial(); 2273 | } 2274 | 2275 | break; 2276 | } 2277 | case 18: { 2278 | WeatherOuterClass.Atmosphere.Builder subBuilder = null; 2279 | if (atmosphere_ != null) { 2280 | subBuilder = atmosphere_.toBuilder(); 2281 | } 2282 | atmosphere_ = input.readMessage(WeatherOuterClass.Atmosphere.parser(), extensionRegistry); 2283 | if (subBuilder != null) { 2284 | subBuilder.mergeFrom(atmosphere_); 2285 | atmosphere_ = subBuilder.buildPartial(); 2286 | } 2287 | 2288 | break; 2289 | } 2290 | case 26: { 2291 | if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { 2292 | forecast_ = new java.util.ArrayList(); 2293 | mutable_bitField0_ |= 0x00000004; 2294 | } 2295 | forecast_.add( 2296 | input.readMessage(WeatherOuterClass.Forecast.parser(), extensionRegistry)); 2297 | break; 2298 | } 2299 | } 2300 | } 2301 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 2302 | throw e.setUnfinishedMessage(this); 2303 | } catch (java.io.IOException e) { 2304 | throw new com.google.protobuf.InvalidProtocolBufferException( 2305 | e).setUnfinishedMessage(this); 2306 | } finally { 2307 | if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { 2308 | forecast_ = java.util.Collections.unmodifiableList(forecast_); 2309 | } 2310 | this.unknownFields = unknownFields.build(); 2311 | makeExtensionsImmutable(); 2312 | } 2313 | } 2314 | public static final com.google.protobuf.Descriptors.Descriptor 2315 | getDescriptor() { 2316 | return WeatherOuterClass.internal_static_Weather_descriptor; 2317 | } 2318 | 2319 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 2320 | internalGetFieldAccessorTable() { 2321 | return WeatherOuterClass.internal_static_Weather_fieldAccessorTable 2322 | .ensureFieldAccessorsInitialized( 2323 | WeatherOuterClass.Weather.class, WeatherOuterClass.Weather.Builder.class); 2324 | } 2325 | 2326 | private int bitField0_; 2327 | public static final int WIND_FIELD_NUMBER = 1; 2328 | private WeatherOuterClass.Wind wind_; 2329 | /** 2330 | * .Wind wind = 1; 2331 | */ 2332 | public boolean hasWind() { 2333 | return wind_ != null; 2334 | } 2335 | /** 2336 | * .Wind wind = 1; 2337 | */ 2338 | public WeatherOuterClass.Wind getWind() { 2339 | return wind_ == null ? WeatherOuterClass.Wind.getDefaultInstance() : wind_; 2340 | } 2341 | /** 2342 | * .Wind wind = 1; 2343 | */ 2344 | public WeatherOuterClass.WindOrBuilder getWindOrBuilder() { 2345 | return getWind(); 2346 | } 2347 | 2348 | public static final int ATMOSPHERE_FIELD_NUMBER = 2; 2349 | private WeatherOuterClass.Atmosphere atmosphere_; 2350 | /** 2351 | * .Atmosphere atmosphere = 2; 2352 | */ 2353 | public boolean hasAtmosphere() { 2354 | return atmosphere_ != null; 2355 | } 2356 | /** 2357 | * .Atmosphere atmosphere = 2; 2358 | */ 2359 | public WeatherOuterClass.Atmosphere getAtmosphere() { 2360 | return atmosphere_ == null ? WeatherOuterClass.Atmosphere.getDefaultInstance() : atmosphere_; 2361 | } 2362 | /** 2363 | * .Atmosphere atmosphere = 2; 2364 | */ 2365 | public WeatherOuterClass.AtmosphereOrBuilder getAtmosphereOrBuilder() { 2366 | return getAtmosphere(); 2367 | } 2368 | 2369 | public static final int FORECAST_FIELD_NUMBER = 3; 2370 | private java.util.List forecast_; 2371 | /** 2372 | * repeated .Forecast forecast = 3; 2373 | */ 2374 | public java.util.List getForecastList() { 2375 | return forecast_; 2376 | } 2377 | /** 2378 | * repeated .Forecast forecast = 3; 2379 | */ 2380 | public java.util.List 2381 | getForecastOrBuilderList() { 2382 | return forecast_; 2383 | } 2384 | /** 2385 | * repeated .Forecast forecast = 3; 2386 | */ 2387 | public int getForecastCount() { 2388 | return forecast_.size(); 2389 | } 2390 | /** 2391 | * repeated .Forecast forecast = 3; 2392 | */ 2393 | public WeatherOuterClass.Forecast getForecast(int index) { 2394 | return forecast_.get(index); 2395 | } 2396 | /** 2397 | * repeated .Forecast forecast = 3; 2398 | */ 2399 | public WeatherOuterClass.ForecastOrBuilder getForecastOrBuilder( 2400 | int index) { 2401 | return forecast_.get(index); 2402 | } 2403 | 2404 | private byte memoizedIsInitialized = -1; 2405 | public final boolean isInitialized() { 2406 | byte isInitialized = memoizedIsInitialized; 2407 | if (isInitialized == 1) return true; 2408 | if (isInitialized == 0) return false; 2409 | 2410 | memoizedIsInitialized = 1; 2411 | return true; 2412 | } 2413 | 2414 | public void writeTo(com.google.protobuf.CodedOutputStream output) 2415 | throws java.io.IOException { 2416 | if (wind_ != null) { 2417 | output.writeMessage(1, getWind()); 2418 | } 2419 | if (atmosphere_ != null) { 2420 | output.writeMessage(2, getAtmosphere()); 2421 | } 2422 | for (int i = 0; i < forecast_.size(); i++) { 2423 | output.writeMessage(3, forecast_.get(i)); 2424 | } 2425 | unknownFields.writeTo(output); 2426 | } 2427 | 2428 | public int getSerializedSize() { 2429 | int size = memoizedSize; 2430 | if (size != -1) return size; 2431 | 2432 | size = 0; 2433 | if (wind_ != null) { 2434 | size += com.google.protobuf.CodedOutputStream 2435 | .computeMessageSize(1, getWind()); 2436 | } 2437 | if (atmosphere_ != null) { 2438 | size += com.google.protobuf.CodedOutputStream 2439 | .computeMessageSize(2, getAtmosphere()); 2440 | } 2441 | for (int i = 0; i < forecast_.size(); i++) { 2442 | size += com.google.protobuf.CodedOutputStream 2443 | .computeMessageSize(3, forecast_.get(i)); 2444 | } 2445 | size += unknownFields.getSerializedSize(); 2446 | memoizedSize = size; 2447 | return size; 2448 | } 2449 | 2450 | @java.lang.Override 2451 | public boolean equals(final java.lang.Object obj) { 2452 | if (obj == this) { 2453 | return true; 2454 | } 2455 | if (!(obj instanceof WeatherOuterClass.Weather)) { 2456 | return super.equals(obj); 2457 | } 2458 | WeatherOuterClass.Weather other = (WeatherOuterClass.Weather) obj; 2459 | 2460 | boolean result = true; 2461 | result = result && (hasWind() == other.hasWind()); 2462 | if (hasWind()) { 2463 | result = result && getWind() 2464 | .equals(other.getWind()); 2465 | } 2466 | result = result && (hasAtmosphere() == other.hasAtmosphere()); 2467 | if (hasAtmosphere()) { 2468 | result = result && getAtmosphere() 2469 | .equals(other.getAtmosphere()); 2470 | } 2471 | result = result && getForecastList() 2472 | .equals(other.getForecastList()); 2473 | result = result && unknownFields.equals(other.unknownFields); 2474 | return result; 2475 | } 2476 | 2477 | @java.lang.Override 2478 | public int hashCode() { 2479 | if (memoizedHashCode != 0) { 2480 | return memoizedHashCode; 2481 | } 2482 | int hash = 41; 2483 | hash = (19 * hash) + getDescriptor().hashCode(); 2484 | if (hasWind()) { 2485 | hash = (37 * hash) + WIND_FIELD_NUMBER; 2486 | hash = (53 * hash) + getWind().hashCode(); 2487 | } 2488 | if (hasAtmosphere()) { 2489 | hash = (37 * hash) + ATMOSPHERE_FIELD_NUMBER; 2490 | hash = (53 * hash) + getAtmosphere().hashCode(); 2491 | } 2492 | if (getForecastCount() > 0) { 2493 | hash = (37 * hash) + FORECAST_FIELD_NUMBER; 2494 | hash = (53 * hash) + getForecastList().hashCode(); 2495 | } 2496 | hash = (29 * hash) + unknownFields.hashCode(); 2497 | memoizedHashCode = hash; 2498 | return hash; 2499 | } 2500 | 2501 | public static WeatherOuterClass.Weather parseFrom( 2502 | java.nio.ByteBuffer data) 2503 | throws com.google.protobuf.InvalidProtocolBufferException { 2504 | return PARSER.parseFrom(data); 2505 | } 2506 | public static WeatherOuterClass.Weather parseFrom( 2507 | java.nio.ByteBuffer data, 2508 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2509 | throws com.google.protobuf.InvalidProtocolBufferException { 2510 | return PARSER.parseFrom(data, extensionRegistry); 2511 | } 2512 | public static WeatherOuterClass.Weather parseFrom( 2513 | com.google.protobuf.ByteString data) 2514 | throws com.google.protobuf.InvalidProtocolBufferException { 2515 | return PARSER.parseFrom(data); 2516 | } 2517 | public static WeatherOuterClass.Weather parseFrom( 2518 | com.google.protobuf.ByteString data, 2519 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2520 | throws com.google.protobuf.InvalidProtocolBufferException { 2521 | return PARSER.parseFrom(data, extensionRegistry); 2522 | } 2523 | public static WeatherOuterClass.Weather parseFrom(byte[] data) 2524 | throws com.google.protobuf.InvalidProtocolBufferException { 2525 | return PARSER.parseFrom(data); 2526 | } 2527 | public static WeatherOuterClass.Weather parseFrom( 2528 | byte[] data, 2529 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2530 | throws com.google.protobuf.InvalidProtocolBufferException { 2531 | return PARSER.parseFrom(data, extensionRegistry); 2532 | } 2533 | public static WeatherOuterClass.Weather parseFrom(java.io.InputStream input) 2534 | throws java.io.IOException { 2535 | return com.google.protobuf.GeneratedMessageV3 2536 | .parseWithIOException(PARSER, input); 2537 | } 2538 | public static WeatherOuterClass.Weather parseFrom( 2539 | java.io.InputStream input, 2540 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2541 | throws java.io.IOException { 2542 | return com.google.protobuf.GeneratedMessageV3 2543 | .parseWithIOException(PARSER, input, extensionRegistry); 2544 | } 2545 | public static WeatherOuterClass.Weather parseDelimitedFrom(java.io.InputStream input) 2546 | throws java.io.IOException { 2547 | return com.google.protobuf.GeneratedMessageV3 2548 | .parseDelimitedWithIOException(PARSER, input); 2549 | } 2550 | public static WeatherOuterClass.Weather parseDelimitedFrom( 2551 | java.io.InputStream input, 2552 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2553 | throws java.io.IOException { 2554 | return com.google.protobuf.GeneratedMessageV3 2555 | .parseDelimitedWithIOException(PARSER, input, extensionRegistry); 2556 | } 2557 | public static WeatherOuterClass.Weather parseFrom( 2558 | com.google.protobuf.CodedInputStream input) 2559 | throws java.io.IOException { 2560 | return com.google.protobuf.GeneratedMessageV3 2561 | .parseWithIOException(PARSER, input); 2562 | } 2563 | public static WeatherOuterClass.Weather parseFrom( 2564 | com.google.protobuf.CodedInputStream input, 2565 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2566 | throws java.io.IOException { 2567 | return com.google.protobuf.GeneratedMessageV3 2568 | .parseWithIOException(PARSER, input, extensionRegistry); 2569 | } 2570 | 2571 | public Builder newBuilderForType() { return newBuilder(); } 2572 | public static Builder newBuilder() { 2573 | return DEFAULT_INSTANCE.toBuilder(); 2574 | } 2575 | public static Builder newBuilder(WeatherOuterClass.Weather prototype) { 2576 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 2577 | } 2578 | public Builder toBuilder() { 2579 | return this == DEFAULT_INSTANCE 2580 | ? new Builder() : new Builder().mergeFrom(this); 2581 | } 2582 | 2583 | @java.lang.Override 2584 | protected Builder newBuilderForType( 2585 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 2586 | Builder builder = new Builder(parent); 2587 | return builder; 2588 | } 2589 | /** 2590 | * Protobuf type {@code Weather} 2591 | */ 2592 | public static final class Builder extends 2593 | com.google.protobuf.GeneratedMessageV3.Builder implements 2594 | // @@protoc_insertion_point(builder_implements:Weather) 2595 | WeatherOuterClass.WeatherOrBuilder { 2596 | public static final com.google.protobuf.Descriptors.Descriptor 2597 | getDescriptor() { 2598 | return WeatherOuterClass.internal_static_Weather_descriptor; 2599 | } 2600 | 2601 | protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 2602 | internalGetFieldAccessorTable() { 2603 | return WeatherOuterClass.internal_static_Weather_fieldAccessorTable 2604 | .ensureFieldAccessorsInitialized( 2605 | WeatherOuterClass.Weather.class, WeatherOuterClass.Weather.Builder.class); 2606 | } 2607 | 2608 | // Construct using WeatherOuterClass.Weather.newBuilder() 2609 | private Builder() { 2610 | maybeForceBuilderInitialization(); 2611 | } 2612 | 2613 | private Builder( 2614 | com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 2615 | super(parent); 2616 | maybeForceBuilderInitialization(); 2617 | } 2618 | private void maybeForceBuilderInitialization() { 2619 | if (com.google.protobuf.GeneratedMessageV3 2620 | .alwaysUseFieldBuilders) { 2621 | getForecastFieldBuilder(); 2622 | } 2623 | } 2624 | public Builder clear() { 2625 | super.clear(); 2626 | if (windBuilder_ == null) { 2627 | wind_ = null; 2628 | } else { 2629 | wind_ = null; 2630 | windBuilder_ = null; 2631 | } 2632 | if (atmosphereBuilder_ == null) { 2633 | atmosphere_ = null; 2634 | } else { 2635 | atmosphere_ = null; 2636 | atmosphereBuilder_ = null; 2637 | } 2638 | if (forecastBuilder_ == null) { 2639 | forecast_ = java.util.Collections.emptyList(); 2640 | bitField0_ = (bitField0_ & ~0x00000004); 2641 | } else { 2642 | forecastBuilder_.clear(); 2643 | } 2644 | return this; 2645 | } 2646 | 2647 | public com.google.protobuf.Descriptors.Descriptor 2648 | getDescriptorForType() { 2649 | return WeatherOuterClass.internal_static_Weather_descriptor; 2650 | } 2651 | 2652 | public WeatherOuterClass.Weather getDefaultInstanceForType() { 2653 | return WeatherOuterClass.Weather.getDefaultInstance(); 2654 | } 2655 | 2656 | public WeatherOuterClass.Weather build() { 2657 | WeatherOuterClass.Weather result = buildPartial(); 2658 | if (!result.isInitialized()) { 2659 | throw newUninitializedMessageException(result); 2660 | } 2661 | return result; 2662 | } 2663 | 2664 | public WeatherOuterClass.Weather buildPartial() { 2665 | WeatherOuterClass.Weather result = new WeatherOuterClass.Weather(this); 2666 | int from_bitField0_ = bitField0_; 2667 | int to_bitField0_ = 0; 2668 | if (windBuilder_ == null) { 2669 | result.wind_ = wind_; 2670 | } else { 2671 | result.wind_ = windBuilder_.build(); 2672 | } 2673 | if (atmosphereBuilder_ == null) { 2674 | result.atmosphere_ = atmosphere_; 2675 | } else { 2676 | result.atmosphere_ = atmosphereBuilder_.build(); 2677 | } 2678 | if (forecastBuilder_ == null) { 2679 | if (((bitField0_ & 0x00000004) == 0x00000004)) { 2680 | forecast_ = java.util.Collections.unmodifiableList(forecast_); 2681 | bitField0_ = (bitField0_ & ~0x00000004); 2682 | } 2683 | result.forecast_ = forecast_; 2684 | } else { 2685 | result.forecast_ = forecastBuilder_.build(); 2686 | } 2687 | result.bitField0_ = to_bitField0_; 2688 | onBuilt(); 2689 | return result; 2690 | } 2691 | 2692 | public Builder clone() { 2693 | return (Builder) super.clone(); 2694 | } 2695 | public Builder setField( 2696 | com.google.protobuf.Descriptors.FieldDescriptor field, 2697 | java.lang.Object value) { 2698 | return (Builder) super.setField(field, value); 2699 | } 2700 | public Builder clearField( 2701 | com.google.protobuf.Descriptors.FieldDescriptor field) { 2702 | return (Builder) super.clearField(field); 2703 | } 2704 | public Builder clearOneof( 2705 | com.google.protobuf.Descriptors.OneofDescriptor oneof) { 2706 | return (Builder) super.clearOneof(oneof); 2707 | } 2708 | public Builder setRepeatedField( 2709 | com.google.protobuf.Descriptors.FieldDescriptor field, 2710 | int index, java.lang.Object value) { 2711 | return (Builder) super.setRepeatedField(field, index, value); 2712 | } 2713 | public Builder addRepeatedField( 2714 | com.google.protobuf.Descriptors.FieldDescriptor field, 2715 | java.lang.Object value) { 2716 | return (Builder) super.addRepeatedField(field, value); 2717 | } 2718 | public Builder mergeFrom(com.google.protobuf.Message other) { 2719 | if (other instanceof WeatherOuterClass.Weather) { 2720 | return mergeFrom((WeatherOuterClass.Weather)other); 2721 | } else { 2722 | super.mergeFrom(other); 2723 | return this; 2724 | } 2725 | } 2726 | 2727 | public Builder mergeFrom(WeatherOuterClass.Weather other) { 2728 | if (other == WeatherOuterClass.Weather.getDefaultInstance()) return this; 2729 | if (other.hasWind()) { 2730 | mergeWind(other.getWind()); 2731 | } 2732 | if (other.hasAtmosphere()) { 2733 | mergeAtmosphere(other.getAtmosphere()); 2734 | } 2735 | if (forecastBuilder_ == null) { 2736 | if (!other.forecast_.isEmpty()) { 2737 | if (forecast_.isEmpty()) { 2738 | forecast_ = other.forecast_; 2739 | bitField0_ = (bitField0_ & ~0x00000004); 2740 | } else { 2741 | ensureForecastIsMutable(); 2742 | forecast_.addAll(other.forecast_); 2743 | } 2744 | onChanged(); 2745 | } 2746 | } else { 2747 | if (!other.forecast_.isEmpty()) { 2748 | if (forecastBuilder_.isEmpty()) { 2749 | forecastBuilder_.dispose(); 2750 | forecastBuilder_ = null; 2751 | forecast_ = other.forecast_; 2752 | bitField0_ = (bitField0_ & ~0x00000004); 2753 | forecastBuilder_ = 2754 | com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? 2755 | getForecastFieldBuilder() : null; 2756 | } else { 2757 | forecastBuilder_.addAllMessages(other.forecast_); 2758 | } 2759 | } 2760 | } 2761 | this.mergeUnknownFields(other.unknownFields); 2762 | onChanged(); 2763 | return this; 2764 | } 2765 | 2766 | public final boolean isInitialized() { 2767 | return true; 2768 | } 2769 | 2770 | public Builder mergeFrom( 2771 | com.google.protobuf.CodedInputStream input, 2772 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2773 | throws java.io.IOException { 2774 | WeatherOuterClass.Weather parsedMessage = null; 2775 | try { 2776 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); 2777 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 2778 | parsedMessage = (WeatherOuterClass.Weather) e.getUnfinishedMessage(); 2779 | throw e.unwrapIOException(); 2780 | } finally { 2781 | if (parsedMessage != null) { 2782 | mergeFrom(parsedMessage); 2783 | } 2784 | } 2785 | return this; 2786 | } 2787 | private int bitField0_; 2788 | 2789 | private WeatherOuterClass.Wind wind_ = null; 2790 | private com.google.protobuf.SingleFieldBuilderV3< 2791 | WeatherOuterClass.Wind, WeatherOuterClass.Wind.Builder, WeatherOuterClass.WindOrBuilder> windBuilder_; 2792 | /** 2793 | * .Wind wind = 1; 2794 | */ 2795 | public boolean hasWind() { 2796 | return windBuilder_ != null || wind_ != null; 2797 | } 2798 | /** 2799 | * .Wind wind = 1; 2800 | */ 2801 | public WeatherOuterClass.Wind getWind() { 2802 | if (windBuilder_ == null) { 2803 | return wind_ == null ? WeatherOuterClass.Wind.getDefaultInstance() : wind_; 2804 | } else { 2805 | return windBuilder_.getMessage(); 2806 | } 2807 | } 2808 | /** 2809 | * .Wind wind = 1; 2810 | */ 2811 | public Builder setWind(WeatherOuterClass.Wind value) { 2812 | if (windBuilder_ == null) { 2813 | if (value == null) { 2814 | throw new NullPointerException(); 2815 | } 2816 | wind_ = value; 2817 | onChanged(); 2818 | } else { 2819 | windBuilder_.setMessage(value); 2820 | } 2821 | 2822 | return this; 2823 | } 2824 | /** 2825 | * .Wind wind = 1; 2826 | */ 2827 | public Builder setWind( 2828 | WeatherOuterClass.Wind.Builder builderForValue) { 2829 | if (windBuilder_ == null) { 2830 | wind_ = builderForValue.build(); 2831 | onChanged(); 2832 | } else { 2833 | windBuilder_.setMessage(builderForValue.build()); 2834 | } 2835 | 2836 | return this; 2837 | } 2838 | /** 2839 | * .Wind wind = 1; 2840 | */ 2841 | public Builder mergeWind(WeatherOuterClass.Wind value) { 2842 | if (windBuilder_ == null) { 2843 | if (wind_ != null) { 2844 | wind_ = 2845 | WeatherOuterClass.Wind.newBuilder(wind_).mergeFrom(value).buildPartial(); 2846 | } else { 2847 | wind_ = value; 2848 | } 2849 | onChanged(); 2850 | } else { 2851 | windBuilder_.mergeFrom(value); 2852 | } 2853 | 2854 | return this; 2855 | } 2856 | /** 2857 | * .Wind wind = 1; 2858 | */ 2859 | public Builder clearWind() { 2860 | if (windBuilder_ == null) { 2861 | wind_ = null; 2862 | onChanged(); 2863 | } else { 2864 | wind_ = null; 2865 | windBuilder_ = null; 2866 | } 2867 | 2868 | return this; 2869 | } 2870 | /** 2871 | * .Wind wind = 1; 2872 | */ 2873 | public WeatherOuterClass.Wind.Builder getWindBuilder() { 2874 | 2875 | onChanged(); 2876 | return getWindFieldBuilder().getBuilder(); 2877 | } 2878 | /** 2879 | * .Wind wind = 1; 2880 | */ 2881 | public WeatherOuterClass.WindOrBuilder getWindOrBuilder() { 2882 | if (windBuilder_ != null) { 2883 | return windBuilder_.getMessageOrBuilder(); 2884 | } else { 2885 | return wind_ == null ? 2886 | WeatherOuterClass.Wind.getDefaultInstance() : wind_; 2887 | } 2888 | } 2889 | /** 2890 | * .Wind wind = 1; 2891 | */ 2892 | private com.google.protobuf.SingleFieldBuilderV3< 2893 | WeatherOuterClass.Wind, WeatherOuterClass.Wind.Builder, WeatherOuterClass.WindOrBuilder> 2894 | getWindFieldBuilder() { 2895 | if (windBuilder_ == null) { 2896 | windBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< 2897 | WeatherOuterClass.Wind, WeatherOuterClass.Wind.Builder, WeatherOuterClass.WindOrBuilder>( 2898 | getWind(), 2899 | getParentForChildren(), 2900 | isClean()); 2901 | wind_ = null; 2902 | } 2903 | return windBuilder_; 2904 | } 2905 | 2906 | private WeatherOuterClass.Atmosphere atmosphere_ = null; 2907 | private com.google.protobuf.SingleFieldBuilderV3< 2908 | WeatherOuterClass.Atmosphere, WeatherOuterClass.Atmosphere.Builder, WeatherOuterClass.AtmosphereOrBuilder> atmosphereBuilder_; 2909 | /** 2910 | * .Atmosphere atmosphere = 2; 2911 | */ 2912 | public boolean hasAtmosphere() { 2913 | return atmosphereBuilder_ != null || atmosphere_ != null; 2914 | } 2915 | /** 2916 | * .Atmosphere atmosphere = 2; 2917 | */ 2918 | public WeatherOuterClass.Atmosphere getAtmosphere() { 2919 | if (atmosphereBuilder_ == null) { 2920 | return atmosphere_ == null ? WeatherOuterClass.Atmosphere.getDefaultInstance() : atmosphere_; 2921 | } else { 2922 | return atmosphereBuilder_.getMessage(); 2923 | } 2924 | } 2925 | /** 2926 | * .Atmosphere atmosphere = 2; 2927 | */ 2928 | public Builder setAtmosphere(WeatherOuterClass.Atmosphere value) { 2929 | if (atmosphereBuilder_ == null) { 2930 | if (value == null) { 2931 | throw new NullPointerException(); 2932 | } 2933 | atmosphere_ = value; 2934 | onChanged(); 2935 | } else { 2936 | atmosphereBuilder_.setMessage(value); 2937 | } 2938 | 2939 | return this; 2940 | } 2941 | /** 2942 | * .Atmosphere atmosphere = 2; 2943 | */ 2944 | public Builder setAtmosphere( 2945 | WeatherOuterClass.Atmosphere.Builder builderForValue) { 2946 | if (atmosphereBuilder_ == null) { 2947 | atmosphere_ = builderForValue.build(); 2948 | onChanged(); 2949 | } else { 2950 | atmosphereBuilder_.setMessage(builderForValue.build()); 2951 | } 2952 | 2953 | return this; 2954 | } 2955 | /** 2956 | * .Atmosphere atmosphere = 2; 2957 | */ 2958 | public Builder mergeAtmosphere(WeatherOuterClass.Atmosphere value) { 2959 | if (atmosphereBuilder_ == null) { 2960 | if (atmosphere_ != null) { 2961 | atmosphere_ = 2962 | WeatherOuterClass.Atmosphere.newBuilder(atmosphere_).mergeFrom(value).buildPartial(); 2963 | } else { 2964 | atmosphere_ = value; 2965 | } 2966 | onChanged(); 2967 | } else { 2968 | atmosphereBuilder_.mergeFrom(value); 2969 | } 2970 | 2971 | return this; 2972 | } 2973 | /** 2974 | * .Atmosphere atmosphere = 2; 2975 | */ 2976 | public Builder clearAtmosphere() { 2977 | if (atmosphereBuilder_ == null) { 2978 | atmosphere_ = null; 2979 | onChanged(); 2980 | } else { 2981 | atmosphere_ = null; 2982 | atmosphereBuilder_ = null; 2983 | } 2984 | 2985 | return this; 2986 | } 2987 | /** 2988 | * .Atmosphere atmosphere = 2; 2989 | */ 2990 | public WeatherOuterClass.Atmosphere.Builder getAtmosphereBuilder() { 2991 | 2992 | onChanged(); 2993 | return getAtmosphereFieldBuilder().getBuilder(); 2994 | } 2995 | /** 2996 | * .Atmosphere atmosphere = 2; 2997 | */ 2998 | public WeatherOuterClass.AtmosphereOrBuilder getAtmosphereOrBuilder() { 2999 | if (atmosphereBuilder_ != null) { 3000 | return atmosphereBuilder_.getMessageOrBuilder(); 3001 | } else { 3002 | return atmosphere_ == null ? 3003 | WeatherOuterClass.Atmosphere.getDefaultInstance() : atmosphere_; 3004 | } 3005 | } 3006 | /** 3007 | * .Atmosphere atmosphere = 2; 3008 | */ 3009 | private com.google.protobuf.SingleFieldBuilderV3< 3010 | WeatherOuterClass.Atmosphere, WeatherOuterClass.Atmosphere.Builder, WeatherOuterClass.AtmosphereOrBuilder> 3011 | getAtmosphereFieldBuilder() { 3012 | if (atmosphereBuilder_ == null) { 3013 | atmosphereBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< 3014 | WeatherOuterClass.Atmosphere, WeatherOuterClass.Atmosphere.Builder, WeatherOuterClass.AtmosphereOrBuilder>( 3015 | getAtmosphere(), 3016 | getParentForChildren(), 3017 | isClean()); 3018 | atmosphere_ = null; 3019 | } 3020 | return atmosphereBuilder_; 3021 | } 3022 | 3023 | private java.util.List forecast_ = 3024 | java.util.Collections.emptyList(); 3025 | private void ensureForecastIsMutable() { 3026 | if (!((bitField0_ & 0x00000004) == 0x00000004)) { 3027 | forecast_ = new java.util.ArrayList(forecast_); 3028 | bitField0_ |= 0x00000004; 3029 | } 3030 | } 3031 | 3032 | private com.google.protobuf.RepeatedFieldBuilderV3< 3033 | WeatherOuterClass.Forecast, WeatherOuterClass.Forecast.Builder, WeatherOuterClass.ForecastOrBuilder> forecastBuilder_; 3034 | 3035 | /** 3036 | * repeated .Forecast forecast = 3; 3037 | */ 3038 | public java.util.List getForecastList() { 3039 | if (forecastBuilder_ == null) { 3040 | return java.util.Collections.unmodifiableList(forecast_); 3041 | } else { 3042 | return forecastBuilder_.getMessageList(); 3043 | } 3044 | } 3045 | /** 3046 | * repeated .Forecast forecast = 3; 3047 | */ 3048 | public int getForecastCount() { 3049 | if (forecastBuilder_ == null) { 3050 | return forecast_.size(); 3051 | } else { 3052 | return forecastBuilder_.getCount(); 3053 | } 3054 | } 3055 | /** 3056 | * repeated .Forecast forecast = 3; 3057 | */ 3058 | public WeatherOuterClass.Forecast getForecast(int index) { 3059 | if (forecastBuilder_ == null) { 3060 | return forecast_.get(index); 3061 | } else { 3062 | return forecastBuilder_.getMessage(index); 3063 | } 3064 | } 3065 | /** 3066 | * repeated .Forecast forecast = 3; 3067 | */ 3068 | public Builder setForecast( 3069 | int index, WeatherOuterClass.Forecast value) { 3070 | if (forecastBuilder_ == null) { 3071 | if (value == null) { 3072 | throw new NullPointerException(); 3073 | } 3074 | ensureForecastIsMutable(); 3075 | forecast_.set(index, value); 3076 | onChanged(); 3077 | } else { 3078 | forecastBuilder_.setMessage(index, value); 3079 | } 3080 | return this; 3081 | } 3082 | /** 3083 | * repeated .Forecast forecast = 3; 3084 | */ 3085 | public Builder setForecast( 3086 | int index, WeatherOuterClass.Forecast.Builder builderForValue) { 3087 | if (forecastBuilder_ == null) { 3088 | ensureForecastIsMutable(); 3089 | forecast_.set(index, builderForValue.build()); 3090 | onChanged(); 3091 | } else { 3092 | forecastBuilder_.setMessage(index, builderForValue.build()); 3093 | } 3094 | return this; 3095 | } 3096 | /** 3097 | * repeated .Forecast forecast = 3; 3098 | */ 3099 | public Builder addForecast(WeatherOuterClass.Forecast value) { 3100 | if (forecastBuilder_ == null) { 3101 | if (value == null) { 3102 | throw new NullPointerException(); 3103 | } 3104 | ensureForecastIsMutable(); 3105 | forecast_.add(value); 3106 | onChanged(); 3107 | } else { 3108 | forecastBuilder_.addMessage(value); 3109 | } 3110 | return this; 3111 | } 3112 | /** 3113 | * repeated .Forecast forecast = 3; 3114 | */ 3115 | public Builder addForecast( 3116 | int index, WeatherOuterClass.Forecast value) { 3117 | if (forecastBuilder_ == null) { 3118 | if (value == null) { 3119 | throw new NullPointerException(); 3120 | } 3121 | ensureForecastIsMutable(); 3122 | forecast_.add(index, value); 3123 | onChanged(); 3124 | } else { 3125 | forecastBuilder_.addMessage(index, value); 3126 | } 3127 | return this; 3128 | } 3129 | /** 3130 | * repeated .Forecast forecast = 3; 3131 | */ 3132 | public Builder addForecast( 3133 | WeatherOuterClass.Forecast.Builder builderForValue) { 3134 | if (forecastBuilder_ == null) { 3135 | ensureForecastIsMutable(); 3136 | forecast_.add(builderForValue.build()); 3137 | onChanged(); 3138 | } else { 3139 | forecastBuilder_.addMessage(builderForValue.build()); 3140 | } 3141 | return this; 3142 | } 3143 | /** 3144 | * repeated .Forecast forecast = 3; 3145 | */ 3146 | public Builder addForecast( 3147 | int index, WeatherOuterClass.Forecast.Builder builderForValue) { 3148 | if (forecastBuilder_ == null) { 3149 | ensureForecastIsMutable(); 3150 | forecast_.add(index, builderForValue.build()); 3151 | onChanged(); 3152 | } else { 3153 | forecastBuilder_.addMessage(index, builderForValue.build()); 3154 | } 3155 | return this; 3156 | } 3157 | /** 3158 | * repeated .Forecast forecast = 3; 3159 | */ 3160 | public Builder addAllForecast( 3161 | java.lang.Iterable values) { 3162 | if (forecastBuilder_ == null) { 3163 | ensureForecastIsMutable(); 3164 | com.google.protobuf.AbstractMessageLite.Builder.addAll( 3165 | values, forecast_); 3166 | onChanged(); 3167 | } else { 3168 | forecastBuilder_.addAllMessages(values); 3169 | } 3170 | return this; 3171 | } 3172 | /** 3173 | * repeated .Forecast forecast = 3; 3174 | */ 3175 | public Builder clearForecast() { 3176 | if (forecastBuilder_ == null) { 3177 | forecast_ = java.util.Collections.emptyList(); 3178 | bitField0_ = (bitField0_ & ~0x00000004); 3179 | onChanged(); 3180 | } else { 3181 | forecastBuilder_.clear(); 3182 | } 3183 | return this; 3184 | } 3185 | /** 3186 | * repeated .Forecast forecast = 3; 3187 | */ 3188 | public Builder removeForecast(int index) { 3189 | if (forecastBuilder_ == null) { 3190 | ensureForecastIsMutable(); 3191 | forecast_.remove(index); 3192 | onChanged(); 3193 | } else { 3194 | forecastBuilder_.remove(index); 3195 | } 3196 | return this; 3197 | } 3198 | /** 3199 | * repeated .Forecast forecast = 3; 3200 | */ 3201 | public WeatherOuterClass.Forecast.Builder getForecastBuilder( 3202 | int index) { 3203 | return getForecastFieldBuilder().getBuilder(index); 3204 | } 3205 | /** 3206 | * repeated .Forecast forecast = 3; 3207 | */ 3208 | public WeatherOuterClass.ForecastOrBuilder getForecastOrBuilder( 3209 | int index) { 3210 | if (forecastBuilder_ == null) { 3211 | return forecast_.get(index); } else { 3212 | return forecastBuilder_.getMessageOrBuilder(index); 3213 | } 3214 | } 3215 | /** 3216 | * repeated .Forecast forecast = 3; 3217 | */ 3218 | public java.util.List 3219 | getForecastOrBuilderList() { 3220 | if (forecastBuilder_ != null) { 3221 | return forecastBuilder_.getMessageOrBuilderList(); 3222 | } else { 3223 | return java.util.Collections.unmodifiableList(forecast_); 3224 | } 3225 | } 3226 | /** 3227 | * repeated .Forecast forecast = 3; 3228 | */ 3229 | public WeatherOuterClass.Forecast.Builder addForecastBuilder() { 3230 | return getForecastFieldBuilder().addBuilder( 3231 | WeatherOuterClass.Forecast.getDefaultInstance()); 3232 | } 3233 | /** 3234 | * repeated .Forecast forecast = 3; 3235 | */ 3236 | public WeatherOuterClass.Forecast.Builder addForecastBuilder( 3237 | int index) { 3238 | return getForecastFieldBuilder().addBuilder( 3239 | index, WeatherOuterClass.Forecast.getDefaultInstance()); 3240 | } 3241 | /** 3242 | * repeated .Forecast forecast = 3; 3243 | */ 3244 | public java.util.List 3245 | getForecastBuilderList() { 3246 | return getForecastFieldBuilder().getBuilderList(); 3247 | } 3248 | private com.google.protobuf.RepeatedFieldBuilderV3< 3249 | WeatherOuterClass.Forecast, WeatherOuterClass.Forecast.Builder, WeatherOuterClass.ForecastOrBuilder> 3250 | getForecastFieldBuilder() { 3251 | if (forecastBuilder_ == null) { 3252 | forecastBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< 3253 | WeatherOuterClass.Forecast, WeatherOuterClass.Forecast.Builder, WeatherOuterClass.ForecastOrBuilder>( 3254 | forecast_, 3255 | ((bitField0_ & 0x00000004) == 0x00000004), 3256 | getParentForChildren(), 3257 | isClean()); 3258 | forecast_ = null; 3259 | } 3260 | return forecastBuilder_; 3261 | } 3262 | public final Builder setUnknownFields( 3263 | final com.google.protobuf.UnknownFieldSet unknownFields) { 3264 | return super.setUnknownFieldsProto3(unknownFields); 3265 | } 3266 | 3267 | public final Builder mergeUnknownFields( 3268 | final com.google.protobuf.UnknownFieldSet unknownFields) { 3269 | return super.mergeUnknownFields(unknownFields); 3270 | } 3271 | 3272 | 3273 | // @@protoc_insertion_point(builder_scope:Weather) 3274 | } 3275 | 3276 | // @@protoc_insertion_point(class_scope:Weather) 3277 | private static final WeatherOuterClass.Weather DEFAULT_INSTANCE; 3278 | static { 3279 | DEFAULT_INSTANCE = new WeatherOuterClass.Weather(); 3280 | } 3281 | 3282 | public static WeatherOuterClass.Weather getDefaultInstance() { 3283 | return DEFAULT_INSTANCE; 3284 | } 3285 | 3286 | private static final com.google.protobuf.Parser 3287 | PARSER = new com.google.protobuf.AbstractParser() { 3288 | public Weather parsePartialFrom( 3289 | com.google.protobuf.CodedInputStream input, 3290 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 3291 | throws com.google.protobuf.InvalidProtocolBufferException { 3292 | return new Weather(input, extensionRegistry); 3293 | } 3294 | }; 3295 | 3296 | public static com.google.protobuf.Parser parser() { 3297 | return PARSER; 3298 | } 3299 | 3300 | @java.lang.Override 3301 | public com.google.protobuf.Parser getParserForType() { 3302 | return PARSER; 3303 | } 3304 | 3305 | public WeatherOuterClass.Weather getDefaultInstanceForType() { 3306 | return DEFAULT_INSTANCE; 3307 | } 3308 | 3309 | } 3310 | 3311 | private static final com.google.protobuf.Descriptors.Descriptor 3312 | internal_static_Wind_descriptor; 3313 | private static final 3314 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 3315 | internal_static_Wind_fieldAccessorTable; 3316 | private static final com.google.protobuf.Descriptors.Descriptor 3317 | internal_static_Atmosphere_descriptor; 3318 | private static final 3319 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 3320 | internal_static_Atmosphere_fieldAccessorTable; 3321 | private static final com.google.protobuf.Descriptors.Descriptor 3322 | internal_static_Forecast_descriptor; 3323 | private static final 3324 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 3325 | internal_static_Forecast_fieldAccessorTable; 3326 | private static final com.google.protobuf.Descriptors.Descriptor 3327 | internal_static_Weather_descriptor; 3328 | private static final 3329 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable 3330 | internal_static_Weather_fieldAccessorTable; 3331 | 3332 | public static com.google.protobuf.Descriptors.FileDescriptor 3333 | getDescriptor() { 3334 | return descriptor; 3335 | } 3336 | private static com.google.protobuf.Descriptors.FileDescriptor 3337 | descriptor; 3338 | static { 3339 | java.lang.String[] descriptorData = { 3340 | "\n\rweather.proto\"7\n\004Wind\022\r\n\005chill\030\001 \001(\005\022\021" + 3341 | "\n\tdirection\030\002 \001(\005\022\r\n\005speed\030\003 \001(\005\"T\n\nAtmo" + 3342 | "sphere\022\020\n\010humidity\030\001 \001(\005\022\020\n\010pressure\030\002 \001" + 3343 | "(\001\022\016\n\006rising\030\003 \001(\005\022\022\n\nvisibility\030\004 \001(\001\"N" + 3344 | "\n\010Forecast\022\014\n\004date\030\001 \001(\t\022\013\n\003day\030\002 \001(\t\022\014\n" + 3345 | "\004high\030\003 \001(\005\022\013\n\003low\030\004 \001(\005\022\014\n\004text\030\005 \001(\t\"\\" + 3346 | "\n\007Weather\022\023\n\004wind\030\001 \001(\0132\005.Wind\022\037\n\natmosp" + 3347 | "here\030\002 \001(\0132\013.Atmosphere\022\033\n\010forecast\030\003 \003(" + 3348 | "\0132\t.Forecastb\006proto3" 3349 | }; 3350 | com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = 3351 | new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { 3352 | public com.google.protobuf.ExtensionRegistry assignDescriptors( 3353 | com.google.protobuf.Descriptors.FileDescriptor root) { 3354 | descriptor = root; 3355 | return null; 3356 | } 3357 | }; 3358 | com.google.protobuf.Descriptors.FileDescriptor 3359 | .internalBuildGeneratedFileFrom(descriptorData, 3360 | new com.google.protobuf.Descriptors.FileDescriptor[] { 3361 | }, assigner); 3362 | internal_static_Wind_descriptor = 3363 | getDescriptor().getMessageTypes().get(0); 3364 | internal_static_Wind_fieldAccessorTable = new 3365 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( 3366 | internal_static_Wind_descriptor, 3367 | new java.lang.String[] { "Chill", "Direction", "Speed", }); 3368 | internal_static_Atmosphere_descriptor = 3369 | getDescriptor().getMessageTypes().get(1); 3370 | internal_static_Atmosphere_fieldAccessorTable = new 3371 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( 3372 | internal_static_Atmosphere_descriptor, 3373 | new java.lang.String[] { "Humidity", "Pressure", "Rising", "Visibility", }); 3374 | internal_static_Forecast_descriptor = 3375 | getDescriptor().getMessageTypes().get(2); 3376 | internal_static_Forecast_fieldAccessorTable = new 3377 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( 3378 | internal_static_Forecast_descriptor, 3379 | new java.lang.String[] { "Date", "Day", "High", "Low", "Text", }); 3380 | internal_static_Weather_descriptor = 3381 | getDescriptor().getMessageTypes().get(3); 3382 | internal_static_Weather_fieldAccessorTable = new 3383 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( 3384 | internal_static_Weather_descriptor, 3385 | new java.lang.String[] { "Wind", "Atmosphere", "Forecast", }); 3386 | } 3387 | 3388 | // @@protoc_insertion_point(outer_class_scope) 3389 | } 3390 | --------------------------------------------------------------------------------