diff --git a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/Influx.scala b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/Influx.scala index ab101fe6..500f12f5 100644 --- a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/Influx.scala +++ b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/Influx.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.akka import akka.actor.ActorSystem diff --git a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/api/Database.scala b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/api/Database.scala index 524ce1d0..a644e85f 100644 --- a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/api/Database.scala +++ b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/api/Database.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.akka.api import _root_.akka.actor.ActorSystem @@ -20,12 +36,12 @@ import scala.reflect.ClassTag * Date: 27.08.17 */ final class Database(dbName: String, - val credentials: Option[InfluxCredentials], + private[chronicler] val credentials: Option[InfluxCredentials], gzipped: Boolean) - (protected implicit val actorSystem: ActorSystem, - override protected implicit val mat: ActorMaterializer, - override protected implicit val ex: ExecutionContext, - override protected implicit val connection: Connection) + (private[akka] implicit val actorSystem: ActorSystem, + private[akka] implicit val mat: ActorMaterializer, + private[chronicler] implicit val ex: ExecutionContext, + private[akka] implicit val connection: Connection) extends DatabaseIO[Future, RequestEntity](dbName) with AkkaWriter with AkkaReader diff --git a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/api/Measurement.scala b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/api/Measurement.scala index ef45b202..6b0a977c 100644 --- a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/api/Measurement.scala +++ b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/api/Measurement.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.akka.api import _root_.akka.actor.ActorSystem @@ -22,10 +38,10 @@ final class Measurement[E: ClassTag](dbName: String, measurementName: String, val credentials: Option[InfluxCredentials], gzipped: Boolean) - (protected implicit val actorSystem: ActorSystem, - protected implicit val mat: ActorMaterializer, - protected implicit val ex: ExecutionContext, - protected implicit val connection: Connection) + (private[akka] implicit val actorSystem: ActorSystem, + private[akka] implicit val mat: ActorMaterializer, + private[chronicler] implicit val ex: ExecutionContext, + private[akka] implicit val connection: Connection) extends MeasurementIO[Future, E, RequestEntity] with AkkaWriter with AkkaReader diff --git a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/clients/AkkaFullClient.scala b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/clients/AkkaFullClient.scala index 3af7ddcd..d7be1174 100644 --- a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/clients/AkkaFullClient.scala +++ b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/clients/AkkaFullClient.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.akka.clients import _root_.akka.actor.ActorSystem @@ -32,18 +48,19 @@ final class AkkaFullClient(host: String, with HasCredentials with AutoCloseable { - override def mapTo[B](resp: Future[HttpResponse], f: HttpResponse => Future[B]): Future[B] = resp.flatMap(f) + private[chronicler] override def mapTo[B](resp: Future[HttpResponse], + f: HttpResponse => Future[B]): Future[B] = resp.flatMap(f) - protected implicit val mat: ActorMaterializer = ActorMaterializer() - protected implicit val connection: Connection = Http().outgoingConnection(host, port) recover { + private[akka] implicit val mat: ActorMaterializer = ActorMaterializer() + private[akka] implicit val connection: Connection = Http().outgoingConnection(host, port) recover { case ex: StreamTcpException => throw new ConnectionException(ex.getMessage) case unknown => throw new UnknownConnectionException(unknown.getMessage) } - def database(dbName: String): Database = + override def database(dbName: String): Database = new Database(dbName, credentials, gzipped) - def measurement[A: ClassTag](dbName: String, + override def measurement[A: ClassTag](dbName: String, measurementName: String): Measurement[A] = new Measurement[A](dbName, measurementName, credentials, gzipped) diff --git a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/clients/AkkaIOClient.scala b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/clients/AkkaIOClient.scala index 0a0d67b1..536002ff 100644 --- a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/clients/AkkaIOClient.scala +++ b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/clients/AkkaIOClient.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.akka.clients import _root_.akka.actor.ActorSystem @@ -20,12 +36,11 @@ final class AkkaIOClient(host: String, (implicit val ex: ExecutionContext, val system: ActorSystem) extends IOClient[Future, RequestEntity] with AutoCloseable { - protected implicit val mat: ActorMaterializer = ActorMaterializer() - protected implicit val connection: Connection = Http().outgoingConnection(host, port) recover { + private[akka] implicit val mat: ActorMaterializer = ActorMaterializer() + private[akka] implicit val connection: Connection = Http().outgoingConnection(host, port) recover { case ex: StreamTcpException => throw new ConnectionException(ex.getMessage) case unknown => throw new UnknownConnectionException(unknown.getMessage) } - override def database(dbName: String): Database = new Database(dbName, credentials, gzipped) diff --git a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/clients/AkkaManagementClient.scala b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/clients/AkkaManagementClient.scala index 06a41056..93fac2a3 100644 --- a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/clients/AkkaManagementClient.scala +++ b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/clients/AkkaManagementClient.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.akka.clients import _root_.akka.actor.ActorSystem @@ -24,11 +40,11 @@ final class AkkaManagementClient(host: String, with Mappable[Future, HttpResponse] with AutoCloseable { - override def mapTo[B](resp: Future[HttpResponse], - f: HttpResponse => Future[B]): Future[B] = resp.flatMap(f) + private[chronicler] override def mapTo[B](resp: Future[HttpResponse], + f: HttpResponse => Future[B]): Future[B] = resp.flatMap(f) - protected implicit val mat: ActorMaterializer = ActorMaterializer() - protected implicit val connection: Connection = Http().outgoingConnection(host, port) recover { + private[akka] implicit val mat: ActorMaterializer = ActorMaterializer() + private[akka] implicit val connection: Connection = Http().outgoingConnection(host, port) recover { case ex: StreamTcpException => throw new ConnectionException(ex.getMessage) case unknown => throw new UnknownConnectionException(unknown.getMessage) } diff --git a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/handlers/AkkaJsonHandler.scala b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/handlers/AkkaJsonHandler.scala index d5b19196..9a01cc5f 100644 --- a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/handlers/AkkaJsonHandler.scala +++ b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/handlers/AkkaJsonHandler.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.akka.handlers import _root_.akka.http.scaladsl.model.{HttpEntity, HttpResponse} @@ -18,10 +34,10 @@ import scala.concurrent.Future */ private[akka] trait AkkaJsonHandler extends JsonHandler[Future, HttpResponse] with Executable { - protected implicit val mat: ActorMaterializer + private[akka] implicit val mat: ActorMaterializer /** Custom Unmarshaller for Jawn JSON */ - implicit val unm: Unmarshaller[HttpEntity, JValue] = { + private implicit val unm: Unmarshaller[HttpEntity, JValue] = { Unmarshaller.withMaterializer { implicit ex => implicit mat => @@ -32,13 +48,13 @@ private[akka] trait AkkaJsonHandler extends JsonHandler[Future, HttpResponse] wi } } - override def getResponseBody(response: HttpResponse): Future[JValue] = + private[chronicler] override def getResponseBody(response: HttpResponse): Future[JValue] = Unmarshal(response.entity).to[JValue] - override def getResponseError(response: HttpResponse): Future[String] = + private[chronicler]override def getResponseError(response: HttpResponse): Future[String] = getResponseBody(response).map(_.get("error").asString) - override def getOptResponseError(response: HttpResponse): Future[Option[String]] = + private[chronicler]override def getOptResponseError(response: HttpResponse): Future[Option[String]] = getResponseBody(response) .map(_.get("results").arrayValue.flatMap(_.headOption)) .map(_.flatMap(_.get("error").getString)) diff --git a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/handlers/AkkaQueryHandler.scala b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/handlers/AkkaQueryHandler.scala index dc0a9ab2..e210ebab 100644 --- a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/handlers/AkkaQueryHandler.scala +++ b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/handlers/AkkaQueryHandler.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.akka.handlers import _root_.akka.http.scaladsl.model.Uri @@ -11,6 +27,6 @@ import com.github.fsanaulla.chronicler.core.model.HasCredentials */ private[akka] trait AkkaQueryHandler extends QueryHandler[Uri] { self: HasCredentials => - override def buildQuery(uri: String, queryParams: Map[String, String]): Uri = + private[chronicler] override def buildQuery(uri: String, queryParams: Map[String, String]): Uri = Uri(uri).withQuery(Uri.Query(queryParams)) } diff --git a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/handlers/AkkaRequestHandler.scala b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/handlers/AkkaRequestHandler.scala index 7783201a..af6713a3 100644 --- a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/handlers/AkkaRequestHandler.scala +++ b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/handlers/AkkaRequestHandler.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.akka.handlers import _root_.akka.http.scaladsl.model._ @@ -17,11 +33,11 @@ import scala.language.implicitConversions private[akka] trait AkkaRequestHandler extends RequestHandler[Future, HttpRequest, HttpResponse, Uri] { - protected implicit val mat: ActorMaterializer - protected implicit val connection: Connection + private[akka] implicit val mat: ActorMaterializer + private[akka] implicit val connection: Connection - override implicit def req(uri: Uri): HttpRequest = HttpRequest(uri = uri) + private[chronicler] override implicit def req(uri: Uri): HttpRequest = HttpRequest(uri = uri) - override def execute(request: HttpRequest): Future[HttpResponse] = + private[chronicler] override def execute(request: HttpRequest): Future[HttpResponse] = Source.single(request).via(connection).runWith(Sink.head) } diff --git a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/handlers/AkkaResponseHandler.scala b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/handlers/AkkaResponseHandler.scala index f182d750..b6cb5dc3 100644 --- a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/handlers/AkkaResponseHandler.scala +++ b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/handlers/AkkaResponseHandler.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.akka.handlers import _root_.akka.http.scaladsl.model.HttpResponse @@ -16,7 +32,7 @@ import scala.reflect.ClassTag private[akka] trait AkkaResponseHandler extends ResponseHandler[Future, HttpResponse] with AkkaJsonHandler { // Simply result's - override def toResult(response: HttpResponse): Future[WriteResult] = { + private[chronicler] override def toResult(response: HttpResponse): Future[WriteResult] = { response.status.intValue() match { case code if isSuccessful(code) && code != 204 => getOptResponseError(response) map { @@ -33,9 +49,9 @@ private[akka] trait AkkaResponseHandler extends ResponseHandler[Future, HttpResp } } - override def toComplexQueryResult[A: ClassTag, B: ClassTag](response: HttpResponse, - f: (String, Array[A]) => B) - (implicit reader: InfluxReader[A]): Future[QueryResult[B]] = { + private[chronicler] override def toComplexQueryResult[A: ClassTag, B: ClassTag](response: HttpResponse, + f: (String, Array[A]) => B) + (implicit reader: InfluxReader[A]): Future[QueryResult[B]] = { response.status.intValue() match { case code if isSuccessful(code) => getResponseBody(response) @@ -52,7 +68,7 @@ private[akka] trait AkkaResponseHandler extends ResponseHandler[Future, HttpResp } } - override def toQueryJsResult(response: HttpResponse): Future[QueryResult[JArray]] = { + private[chronicler] override def toQueryJsResult(response: HttpResponse): Future[QueryResult[JArray]] = { response.status.intValue() match { case code if isSuccessful(code) => getResponseBody(response) @@ -66,7 +82,7 @@ private[akka] trait AkkaResponseHandler extends ResponseHandler[Future, HttpResp } } - override def toGroupedJsResult(response: HttpResponse): Future[GroupedResult[JArray]] = { + private[chronicler] override def toGroupedJsResult(response: HttpResponse): Future[GroupedResult[JArray]] = { response.status.intValue() match { case code if isSuccessful(code) => getResponseBody(response) @@ -80,7 +96,7 @@ private[akka] trait AkkaResponseHandler extends ResponseHandler[Future, HttpResp } } - override def toBulkQueryJsResult(response: HttpResponse): Future[QueryResult[Array[JArray]]] = { + private[chronicler] override def toBulkQueryJsResult(response: HttpResponse): Future[QueryResult[Array[JArray]]] = { response.status.intValue() match { case code if isSuccessful(code) => getResponseBody(response) @@ -95,10 +111,12 @@ private[akka] trait AkkaResponseHandler extends ResponseHandler[Future, HttpResp } } - override def toQueryResult[A: ClassTag](response: HttpResponse)(implicit reader: InfluxReader[A]): Future[QueryResult[A]] = + private[chronicler] override def toQueryResult[A: ClassTag](response: HttpResponse) + (implicit reader: InfluxReader[A]): Future[QueryResult[A]] = toQueryJsResult(response).map(_.map(reader.read)) - override def errorHandler(response: HttpResponse, code: Int): Future[InfluxException] = code match { + private[chronicler] override def errorHandler(response: HttpResponse, + code: Int): Future[InfluxException] = code match { case 400 => getResponseError(response).map(errMsg => new BadRequestException(errMsg)) case 401 => diff --git a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/io/AkkaReader.scala b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/io/AkkaReader.scala index ba948c0d..36e6d51e 100644 --- a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/io/AkkaReader.scala +++ b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/io/AkkaReader.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.akka.io import _root_.akka.http.scaladsl.model.Uri @@ -22,11 +38,11 @@ private[akka] trait AkkaReader with DatabaseOperationQuery[Uri] { self: ReadOperations[Future] with Executable with HasCredentials => - override def readJs(dbName: String, - query: String, - epoch: Epoch, - pretty: Boolean, - chunked: Boolean): Future[ReadResult[JArray]] = { + private[chronicler] override def readJs(dbName: String, + query: String, + epoch: Epoch, + pretty: Boolean, + chunked: Boolean): Future[ReadResult[JArray]] = { val uri = readFromInfluxSingleQuery(dbName, query, epoch, pretty, chunked) val executionResult = execute(uri) @@ -38,11 +54,11 @@ private[akka] trait AkkaReader } - override def bulkReadJs(dbName: String, - queries: Seq[String], - epoch: Epoch, - pretty: Boolean, - chunked: Boolean): Future[QueryResult[Array[JArray]]] = { + private[chronicler] override def bulkReadJs(dbName: String, + queries: Seq[String], + epoch: Epoch, + pretty: Boolean, + chunked: Boolean): Future[QueryResult[Array[JArray]]] = { val uri = readFromInfluxBulkQuery(dbName, queries, epoch, pretty, chunked) execute(uri).flatMap(toBulkQueryJsResult) diff --git a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/io/AkkaWriter.scala b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/io/AkkaWriter.scala index 7cda84ac..2984f33c 100644 --- a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/io/AkkaWriter.scala +++ b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/io/AkkaWriter.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.akka.io import java.nio.file.Paths @@ -27,10 +43,10 @@ private[akka] trait AkkaWriter with AkkaQueryHandler { self: WriteOperations[Future, RequestEntity] with HasCredentials with Executable => - protected implicit val mat: ActorMaterializer - protected implicit val connection: Connection + private[akka] implicit val mat: ActorMaterializer + private[akka] implicit val connection: Connection - override def writeTo(dbName: String, + private[chronicler] override def writeTo(dbName: String, entity: RequestEntity, consistency: Consistency, precision: Precision, @@ -52,7 +68,7 @@ private[akka] trait AkkaWriter execute(request).flatMap(toResult) } - override def writeFromFile(dbName: String, + private[chronicler] override def writeFromFile(dbName: String, filePath: String, consistency: Consistency, precision: Precision, diff --git a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/models/AkkaSeserializers.scala b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/models/AkkaSeserializers.scala index ff0e3767..5d95a991 100644 --- a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/models/AkkaSeserializers.scala +++ b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/models/AkkaSeserializers.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.akka.models import _root_.akka.http.scaladsl.model.{HttpEntity, RequestEntity} diff --git a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/utils/AkkaAlias.scala b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/utils/AkkaAlias.scala index e5334c4d..723c65c6 100644 --- a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/utils/AkkaAlias.scala +++ b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/utils/AkkaAlias.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.akka.utils import akka.http.scaladsl.Http diff --git a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/utils/AkkaContentTypes.scala b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/utils/AkkaContentTypes.scala index 4862a098..8792cd3e 100644 --- a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/utils/AkkaContentTypes.scala +++ b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/utils/AkkaContentTypes.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.akka.utils import _root_.akka.http.scaladsl.model.{MediaType, MediaTypes} diff --git a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/utils/AkkaHeaders.scala b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/utils/AkkaHeaders.scala index b60658bb..2db910c4 100644 --- a/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/utils/AkkaHeaders.scala +++ b/akka-http/src/main/scala/com/github/fsanaulla/chronicler/akka/utils/AkkaHeaders.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.akka.utils import akka.http.scaladsl.model.headers.{HttpEncodings, `Accept-Encoding`} diff --git a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/Influx.scala b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/Influx.scala index f6586dd6..ba81ca8a 100644 --- a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/Influx.scala +++ b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/Influx.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.async import com.github.fsanaulla.chronicler.async.clients.{AsyncFullClient, AsyncIOClient, AsyncManagementClient} diff --git a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/api/Database.scala b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/api/Database.scala index 2f6806e9..2ed578a1 100644 --- a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/api/Database.scala +++ b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/api/Database.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.async.api import com.github.fsanaulla.chronicler.async.io.{AsyncReader, AsyncWriter} @@ -11,12 +27,12 @@ import jawn.ast.JArray import scala.concurrent.{ExecutionContext, Future} import scala.reflect.ClassTag -final class Database(val host: String, - val port: Int, - val credentials: Option[InfluxCredentials], +final class Database(private[async] val host: String, + private[async] val port: Int, + private[chronicler] val credentials: Option[InfluxCredentials], dbName: String, - gzipped: Boolean)(protected implicit val backend: SttpBackend[Future, Nothing], - protected implicit val ex: ExecutionContext) + gzipped: Boolean)(private[async] implicit val backend: SttpBackend[Future, Nothing], + private[chronicler] implicit val ex: ExecutionContext) extends DatabaseIO[Future, String](dbName) with HasCredentials with Executable diff --git a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/api/Measurement.scala b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/api/Measurement.scala index b0ff49b4..9f6d3556 100644 --- a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/api/Measurement.scala +++ b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/api/Measurement.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.async.api import com.github.fsanaulla.chronicler.async.io.{AsyncReader, AsyncWriter} @@ -10,14 +26,14 @@ import jawn.ast.JArray import scala.concurrent.{ExecutionContext, Future} import scala.reflect.ClassTag -final class Measurement[E: ClassTag](val host: String, - val port: Int, - val credentials: Option[InfluxCredentials], +final class Measurement[E: ClassTag](private[async] val host: String, + private[async] val port: Int, + private[chronicler] val credentials: Option[InfluxCredentials], dbName: String, measurementName: String, gzipped: Boolean) - (protected implicit val ex: ExecutionContext, - protected implicit val backend: SttpBackend[Future, Nothing]) + (private[chronicler] implicit val ex: ExecutionContext, + private[async] implicit val backend: SttpBackend[Future, Nothing]) extends MeasurementIO[Future, E, String] with HasCredentials with AsyncWriter diff --git a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/clients/AsyncFullClient.scala b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/clients/AsyncFullClient.scala index 9691eb60..dbd7e544 100644 --- a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/clients/AsyncFullClient.scala +++ b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/clients/AsyncFullClient.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.async.clients import com.github.fsanaulla.chronicler.async.api.{Database, Measurement} @@ -15,7 +31,8 @@ import scala.reflect.ClassTag final class AsyncFullClient(val host: String, val port: Int, val credentials: Option[InfluxCredentials], - gzipped: Boolean)(implicit val ex: ExecutionContext) + gzipped: Boolean) + (implicit val ex: ExecutionContext) extends FullClient[Future, Request, Response[JValue], Uri, String] with AsyncRequestHandler with AsyncResponseHandler @@ -23,10 +40,11 @@ final class AsyncFullClient(val host: String, with Mappable[Future, Response[JValue]] with AutoCloseable { - protected implicit val backend: SttpBackend[Future, Nothing] = + private[async] implicit val backend: SttpBackend[Future, Nothing] = AsyncHttpClientFutureBackend() - override def mapTo[B](resp: Future[Response[JValue]], f: Response[JValue] => Future[B]): Future[B] = - resp.flatMap(f) + + private[chronicler] override def mapTo[B](resp: Future[Response[JValue]], + f: Response[JValue] => Future[B]): Future[B] = resp.flatMap(f) override def database(dbName: String): Database = new Database(host, port, credentials, dbName, gzipped) diff --git a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/clients/AsyncIOClient.scala b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/clients/AsyncIOClient.scala index ae1f4ca0..3049586d 100644 --- a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/clients/AsyncIOClient.scala +++ b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/clients/AsyncIOClient.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.async.clients import com.github.fsanaulla.chronicler.async.api.{Database, Measurement} @@ -12,10 +28,12 @@ import scala.reflect.ClassTag final class AsyncIOClient(val host: String, val port: Int, val credentials: Option[InfluxCredentials], - gzipped: Boolean)(implicit val ex: ExecutionContext) + gzipped: Boolean) + (implicit val ex: ExecutionContext) extends IOClient[Future, String] with AutoCloseable { - protected implicit val backend: SttpBackend[Future, Nothing] = AsyncHttpClientFutureBackend() + private[async] implicit val backend: SttpBackend[Future, Nothing] = + AsyncHttpClientFutureBackend() override def database(dbName: String): Database = new Database(host, port, credentials, dbName, gzipped) diff --git a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/clients/AsyncManagementClient.scala b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/clients/AsyncManagementClient.scala index 42ee2b3d..1cd91df6 100644 --- a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/clients/AsyncManagementClient.scala +++ b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/clients/AsyncManagementClient.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.async.clients import com.github.fsanaulla.chronicler.async.handlers.{AsyncQueryHandler, AsyncRequestHandler, AsyncResponseHandler} @@ -19,12 +35,13 @@ final class AsyncManagementClient(val host: String, with AsyncResponseHandler with AsyncQueryHandler with Mappable[Future, Response[JValue]] - with AutoCloseable{ + with AutoCloseable { - protected implicit val backend: SttpBackend[Future, Nothing] = + private[async] implicit val backend: SttpBackend[Future, Nothing] = AsyncHttpClientFutureBackend() - override def mapTo[B](resp: Future[Response[JValue]], f: Response[JValue] => Future[B]): Future[B] = - resp.flatMap(f) + + private[chronicler] override def mapTo[B](resp: Future[Response[JValue]], + f: Response[JValue] => Future[B]): Future[B] = resp.flatMap(f) override def close(): Unit = backend.close() diff --git a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncJsonHandler.scala b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncJsonHandler.scala index beaf5c2c..c908ab39 100644 --- a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncJsonHandler.scala +++ b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncJsonHandler.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.async.handlers import com.github.fsanaulla.chronicler.core.handlers.JsonHandler @@ -9,20 +25,19 @@ import jawn.ast.{JParser, JValue} import scala.concurrent.Future private[async] trait AsyncJsonHandler - extends JsonHandler[Future, Response[JValue]] - with Executable { + extends JsonHandler[Future, Response[JValue]] with Executable { - override def getResponseBody(response: Response[JValue]): Future[JValue] = { + private[chronicler] override def getResponseBody(response: Response[JValue]): Future[JValue] = { response.body match { case Right(js) => Future.successful(js) case Left(str) => Future.fromTry(JParser.parseFromString(str)) } } - override def getResponseError(response: Response[JValue]): Future[String] = + private[chronicler] override def getResponseError(response: Response[JValue]): Future[String] = getResponseBody(response).map(_.get("error").asString) - override def getOptResponseError(response: Response[JValue]): Future[Option[String]] = + private[chronicler] override def getOptResponseError(response: Response[JValue]): Future[Option[String]] = getResponseBody(response) .map(_.get("results").arrayValue.flatMap(_.headOption)) .map(_.flatMap(_.get("error").getString)) diff --git a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncQueryHandler.scala b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncQueryHandler.scala index 46f4271b..55d93d2d 100644 --- a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncQueryHandler.scala +++ b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncQueryHandler.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.async.handlers import com.github.fsanaulla.chronicler.core.handlers.QueryHandler @@ -12,11 +28,11 @@ private[async] trait AsyncQueryHandler extends QueryHandler[Uri] with HasCredentials { - protected val host: String - protected val port: Int + private[async] val host: String + private[async] val port: Int - override def buildQuery(uri: String, - queryParams: Map[String, String]): Uri = { + private[chronicler] override def buildQuery(uri: String, + queryParams: Map[String, String]): Uri = { val u = Uri(host = host, port).path(uri) val encoding = Uri.QueryFragmentEncoding.All val kvLst = queryParams.map { diff --git a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncRequestHandler.scala b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncRequestHandler.scala index 9c9cec29..0b6c9014 100644 --- a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncRequestHandler.scala +++ b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncRequestHandler.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.async.handlers import com.github.fsanaulla.chronicler.async.utils.Aliases.Request @@ -11,8 +27,8 @@ import scala.concurrent.Future private[async] trait AsyncRequestHandler extends RequestHandler[Future, Request, Response[JValue], Uri] { - protected implicit val backend: SttpBackend[Future, Nothing] + private[async] implicit val backend: SttpBackend[Future, Nothing] - override implicit def req(uri: Uri): Request = sttp.get(uri).response(asJson) - override def execute(request: Request): Future[Response[JValue]] = request.send() + private[chronicler] override implicit def req(uri: Uri): Request = sttp.get(uri).response(asJson) + private[chronicler] override def execute(request: Request): Future[Response[JValue]] = request.send() } diff --git a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncResponseHandler.scala b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncResponseHandler.scala index 7e7e451c..51ffb4cf 100644 --- a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncResponseHandler.scala +++ b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncResponseHandler.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.async.handlers import com.github.fsanaulla.chronicler.core.handlers.ResponseHandler @@ -12,7 +28,7 @@ private[async] trait AsyncResponseHandler extends ResponseHandler[Future, Response[JValue]] with AsyncJsonHandler { // Simply result's - override def toResult(response: Response[JValue]): Future[WriteResult] = { + private[chronicler] override def toResult(response: Response[JValue]): Future[WriteResult] = { response.code match { case code if isSuccessful(code) && code != 204 => getOptResponseError(response) map { @@ -29,10 +45,9 @@ private[async] trait AsyncResponseHandler } } - override def toComplexQueryResult[A: ClassTag, B: ClassTag]( - response: Response[JValue], - f: (String, Array[A]) => B) - (implicit reader: InfluxReader[A]): Future[QueryResult[B]] = { + private[chronicler] override def toComplexQueryResult[A: ClassTag, B: ClassTag](response: Response[JValue], + f: (String, Array[A]) => B) + (implicit reader: InfluxReader[A]): Future[QueryResult[B]] = { response.code match { case code if isSuccessful(code) => getResponseBody(response) @@ -49,7 +64,7 @@ private[async] trait AsyncResponseHandler } } - override def toQueryJsResult(response: Response[JValue]): Future[QueryResult[JArray]] = { + private[chronicler] override def toQueryJsResult(response: Response[JValue]): Future[QueryResult[JArray]] = { response.code.intValue() match { case code if isSuccessful(code) => getResponseBody(response) @@ -63,7 +78,7 @@ private[async] trait AsyncResponseHandler } } - override def toGroupedJsResult(response: Response[JValue]): Future[GroupedResult[JArray]] = { + private[chronicler] override def toGroupedJsResult(response: Response[JValue]): Future[GroupedResult[JArray]] = { response.code.intValue() match { case code if isSuccessful(code) => getResponseBody(response) @@ -77,7 +92,7 @@ private[async] trait AsyncResponseHandler } } - override def toBulkQueryJsResult(response: Response[JValue]): Future[QueryResult[Array[JArray]]] = { + private[chronicler] override def toBulkQueryJsResult(response: Response[JValue]): Future[QueryResult[Array[JArray]]] = { response.code.intValue() match { case code if isSuccessful(code) => getResponseBody(response) @@ -92,11 +107,12 @@ private[async] trait AsyncResponseHandler } } - override def toQueryResult[A: ClassTag](response: Response[JValue])(implicit reader: InfluxReader[A]): Future[QueryResult[A]] = + private[chronicler] override def toQueryResult[A: ClassTag](response: Response[JValue])(implicit reader: InfluxReader[A]): Future[QueryResult[A]] = toQueryJsResult(response).map(_.map(reader.read)) - override def errorHandler(response: Response[JValue], code: Int): Future[InfluxException] = code match { + private[chronicler] override def errorHandler(response: Response[JValue], + code: Int): Future[InfluxException] = code match { case 400 => getResponseError(response).map(errMsg => new BadRequestException(errMsg)) case 401 => diff --git a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/io/AsyncReader.scala b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/io/AsyncReader.scala index b0d4ea17..f8b7e140 100644 --- a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/io/AsyncReader.scala +++ b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/io/AsyncReader.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.async.io import com.github.fsanaulla.chronicler.async.handlers.{AsyncQueryHandler, AsyncRequestHandler, AsyncResponseHandler} @@ -10,14 +26,13 @@ import jawn.ast.JArray import scala.concurrent.Future -private[fsanaulla] trait AsyncReader +private[async] trait AsyncReader extends AsyncQueryHandler with AsyncRequestHandler with AsyncResponseHandler - with DatabaseOperationQuery[Uri] - with HasCredentials { self: ReadOperations[Future] => + with DatabaseOperationQuery[Uri] { self: ReadOperations[Future] with HasCredentials => - override def readJs(dbName: String, + private[chronicler] override def readJs(dbName: String, query: String, epoch: Epoch, pretty: Boolean, @@ -30,7 +45,7 @@ private[fsanaulla] trait AsyncReader } } - override def bulkReadJs(dbName: String, + private[chronicler] override def bulkReadJs(dbName: String, queries: Seq[String], epoch: Epoch, pretty: Boolean, diff --git a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/io/AsyncWriter.scala b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/io/AsyncWriter.scala index 666983ae..a0366a8a 100644 --- a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/io/AsyncWriter.scala +++ b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/io/AsyncWriter.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.async.io import com.github.fsanaulla.chronicler.async.handlers._ @@ -12,16 +28,14 @@ import com.softwaremill.sttp.{Uri, sttp} import scala.concurrent.Future import scala.io.Source -private[fsanaulla] trait AsyncWriter +private[async] trait AsyncWriter extends DatabaseOperationQuery[Uri] with AsyncRequestHandler with AsyncResponseHandler with AsyncQueryHandler - with PointTransformer - with HasCredentials - with WriteOperations[Future, String] { + with PointTransformer { self: WriteOperations[Future, String] with HasCredentials => - override def writeTo(dbName: String, + private[chronicler] override def writeTo(dbName: String, entity: String, consistency: Consistency, precision: Precision, @@ -38,7 +52,7 @@ private[fsanaulla] trait AsyncWriter execute(maybeEncoded).flatMap(toResult) } - override def writeFromFile(dbName: String, + private[chronicler] override def writeFromFile(dbName: String, filePath: String, consistency: Consistency, precision: Precision, diff --git a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/models/AsyncSerializers.scala b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/models/AsyncSerializers.scala index a06fe6b8..4c71cd2f 100644 --- a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/models/AsyncSerializers.scala +++ b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/models/AsyncSerializers.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.async.models import com.github.fsanaulla.chronicler.core.model.{Point, Serializer} diff --git a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/utils/Aliases.scala b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/utils/Aliases.scala index d2aa207a..93cd5f92 100644 --- a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/utils/Aliases.scala +++ b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/utils/Aliases.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.async.utils import com.softwaremill.sttp.{Id, RequestT} diff --git a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/utils/Extensions.scala b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/utils/Extensions.scala index 5173d709..ba3eb41a 100644 --- a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/utils/Extensions.scala +++ b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/utils/Extensions.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.async.utils import com.softwaremill.sttp.{BodySerializer, Request} diff --git a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/utils/ResponseFormats.scala b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/utils/ResponseFormats.scala index a57e2697..78361dd3 100644 --- a/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/utils/ResponseFormats.scala +++ b/async-http/src/main/scala/com/github/fsanaulla/chronicler/async/utils/ResponseFormats.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.async.utils import com.softwaremill.sttp.{ResponseAs, asString} diff --git a/async-http/src/test/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncResponseHandlerSpec.scala b/async-http/src/test/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncResponseHandlerSpec.scala index 504b9294..6ba0e522 100644 --- a/async-http/src/test/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncResponseHandlerSpec.scala +++ b/async-http/src/test/scala/com/github/fsanaulla/chronicler/async/handlers/AsyncResponseHandlerSpec.scala @@ -22,7 +22,7 @@ class AsyncResponseHandlerSpec extends FlatSpecWithMatchers with AsyncResponseHa implicit val pc: PatienceConfig = PatienceConfig(Span(20, Seconds), Span(1, Second)) - protected implicit val ex: ExecutionContext = ExecutionContext.Implicits.global + implicit val ex: ExecutionContext = ExecutionContext.Implicits.global implicit val timeout: FiniteDuration = 1 second diff --git a/build.sbt b/build.sbt index e91eea2e..73fdf887 100644 --- a/build.sbt +++ b/build.sbt @@ -1,31 +1,22 @@ -import sbt.Keys.{libraryDependencies, name, publishArtifact} - -lazy val chronicler = (project in file(".")) - .settings(Settings.common: _*) - .settings(publishArtifact := false) - .aggregate( - coreModel, - macros, - urlHttp, - akkaHttp, - asyncHttp -// udp - ) +import sbt.Keys.{libraryDependencies, name} lazy val coreApi = project .in(file("core/core-api")) .settings(Settings.common: _*) .settings(Settings.publish: _*) + .settings(Settings.header: _*) .settings( name := "chronicler-core-api", scalacOptions += "-language:higherKinds" ) .dependsOn(coreModel) + .enablePlugins(AutomateHeaderPlugin) lazy val coreModel = project .in(file("core/core-model")) .settings(Settings.common: _*) .settings(Settings.publish: _*) + .settings(Settings.header) .settings( name := "chronicler-core-model", libraryDependencies ++= Dependencies.coreDep, @@ -34,6 +25,7 @@ lazy val coreModel = project "-language:higherKinds" ) ) + .enablePlugins(AutomateHeaderPlugin) lazy val urlHttp = project .in(file("url-http")) @@ -41,11 +33,13 @@ lazy val urlHttp = project .settings(Defaults.itSettings) .settings(Settings.common: _*) .settings(Settings.publish: _*) + .settings(Settings.header) .settings( name := "chronicler-url-http", libraryDependencies ++= Dependencies.urlHttp ) .dependsOn(coreApi) + .enablePlugins(AutomateHeaderPlugin) lazy val akkaHttp = project .in(file("akka-http")) @@ -53,6 +47,7 @@ lazy val akkaHttp = project .settings(Defaults.itSettings) .settings(Settings.common: _*) .settings(Settings.publish: _*) + .settings(Settings.header) .settings( name := "chronicler-akka-http", scalacOptions ++= Seq( @@ -62,6 +57,7 @@ lazy val akkaHttp = project libraryDependencies ++= Dependencies.akkaDep ) .dependsOn(coreApi) + .enablePlugins(AutomateHeaderPlugin) lazy val asyncHttp = project .in(file("async-http")) @@ -69,6 +65,7 @@ lazy val asyncHttp = project .settings(Defaults.itSettings) .settings(Settings.common: _*) .settings(Settings.publish: _*) + .settings(Settings.header) .settings( name := "chronicler-async-http", scalacOptions ++= Seq( @@ -78,6 +75,7 @@ lazy val asyncHttp = project libraryDependencies ++= Dependencies.asyncHttp ) .dependsOn(coreApi) + .enablePlugins(AutomateHeaderPlugin) lazy val udp = project .in(file("udp")) @@ -85,22 +83,26 @@ lazy val udp = project .settings(Defaults.itSettings) .settings(Settings.common: _*) .settings(Settings.publish: _*) + .settings(Settings.header) .settings( name := "chronicler-udp", libraryDependencies ++= Dependencies.udpDep, test in Test := {} ) .dependsOn(coreModel) + .enablePlugins(AutomateHeaderPlugin) lazy val macros = project .in(file("macros")) .settings(Settings.common: _*) .settings(Settings.publish: _*) + .settings(Settings.header) .settings( name := "chronicler-macros", libraryDependencies ++= Dependencies.macroDeps(scalaVersion.value) ) .dependsOn(coreModel) + .enablePlugins(AutomateHeaderPlugin) // Only for test purpose lazy val itTesting = project diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/DatabaseIO.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/DatabaseIO.scala index 47161062..a63aea76 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/DatabaseIO.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/DatabaseIO.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.api import com.github.fsanaulla.chronicler.core.enums._ @@ -62,4 +78,11 @@ abstract class DatabaseIO[M[_], E](dbName: String) extends ReadOperations[M] wit pretty: Boolean = false, chunked: Boolean = false): M[QueryResult[Array[JArray]]] = bulkReadJs(dbName, queries, epoch, pretty, chunked) + + final def writeUniversal(measurement: String, + point: String, + consistency: Consistency = Consistencies.ONE, + precision: Precision = Precisions.NANOSECONDS, + retentionPolicy: Option[String] = None): M[WriteResult] = + writeNative(measurement + "," + point, consistency, precision, retentionPolicy) } diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/MeasurementIO.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/MeasurementIO.scala index d2be1e84..5dc31e38 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/MeasurementIO.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/MeasurementIO.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.api import com.github.fsanaulla.chronicler.core.enums.{Consistency, Precision} diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/ContinuousQueryManagement.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/ContinuousQueryManagement.scala index ae5194c9..dd197c40 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/ContinuousQueryManagement.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/ContinuousQueryManagement.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.api.management import com.github.fsanaulla.chronicler.core.handlers.{QueryHandler, RequestHandler, ResponseHandler} diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/DatabaseManagement.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/DatabaseManagement.scala index 5d5e7ecd..dd2e0e74 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/DatabaseManagement.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/DatabaseManagement.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.api.management import com.github.fsanaulla.chronicler.core.handlers.{QueryHandler, RequestHandler, ResponseHandler} diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/QuerysManagement.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/QuerysManagement.scala index e250f4c4..4550c223 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/QuerysManagement.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/QuerysManagement.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.api.management import com.github.fsanaulla.chronicler.core.handlers.{QueryHandler, RequestHandler, ResponseHandler} diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/RetentionPolicyManagement.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/RetentionPolicyManagement.scala index 386c5aca..62b73218 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/RetentionPolicyManagement.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/RetentionPolicyManagement.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.api.management import com.github.fsanaulla.chronicler.core.handlers.{QueryHandler, RequestHandler, ResponseHandler} diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/ShardManagement.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/ShardManagement.scala index 98c5af45..c21cac59 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/ShardManagement.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/ShardManagement.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.api.management import com.github.fsanaulla.chronicler.core.handlers.{QueryHandler, RequestHandler, ResponseHandler} diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/SubscriptionManagement.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/SubscriptionManagement.scala index df2a410b..2245ed5d 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/SubscriptionManagement.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/SubscriptionManagement.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.api.management import com.github.fsanaulla.chronicler.core.enums.Destination diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/SystemManagement.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/SystemManagement.scala index c9c1a011..ea381ba2 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/SystemManagement.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/SystemManagement.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.api.management import com.github.fsanaulla.chronicler.core.model.WriteResult diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/UserManagement.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/UserManagement.scala index 89954266..323b85af 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/UserManagement.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/api/management/UserManagement.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.api.management import com.github.fsanaulla.chronicler.core.enums.Privilege diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/client/FullClient.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/client/FullClient.scala index 102d2295..2c39e9da 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/client/FullClient.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/client/FullClient.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.client import com.github.fsanaulla.chronicler.core.model.{HasCredentials, Mappable} diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/client/IOClient.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/client/IOClient.scala index 51a497fa..268ed2e3 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/client/IOClient.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/client/IOClient.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.client import com.github.fsanaulla.chronicler.core.api.{DatabaseIO, MeasurementIO} diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/client/ManagementClient.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/client/ManagementClient.scala index ba84694a..15405c00 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/client/ManagementClient.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/client/ManagementClient.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.client import com.github.fsanaulla.chronicler.core.api.management._ diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/handlers/JsonHandler.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/handlers/JsonHandler.scala index 1ccd123a..d235eeef 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/handlers/JsonHandler.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/handlers/JsonHandler.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.handlers import com.github.fsanaulla.chronicler.core.model.InfluxReader @@ -8,44 +24,49 @@ import scala.reflect.ClassTag /*** * Trait that define all necessary methods for handling JSON related operation + * * @tparam R - Response type */ private[chronicler] trait JsonHandler[M[_], R] { /*** * Extracting JSON from Response + * * @param response - Response * @return - Extracted JSON */ - def getResponseBody(response: R): M[JValue] + private[chronicler] def getResponseBody(response: R): M[JValue] /** * Extract error message from response + * * @param response - Response * @return - Error Message */ - def getResponseError(response: R): M[String] + private[chronicler] def getResponseError(response: R): M[String] /** * Extract optional error message from response + * * @param response - Response JSON body * @return - optional error message */ - def getOptResponseError(response: R): M[Option[String]] + private[chronicler] def getOptResponseError(response: R): M[Option[String]] /** * Extract influx points from JSON, representede as Arrays + * * @param js - JSON value * @return - optional array of points */ - final def getOptQueryResult(js: JValue): Option[Array[JArray]] = { + private[chronicler] final def getOptQueryResult(js: JValue): Option[Array[JArray]] = { js.get("results").arrayValue.flatMap(_.headOption) // get head of 'results' field .flatMap(_.get("series").arrayValue.flatMap(_.headOption)) // get head of 'series' field .flatMap(_.get("values").arrayValue) // get array of jValue .map(_.flatMap(_.array)) // map to array of JArray } - final def getOptGropedResult(js: JValue): Option[Array[(Array[String], JArray)]] = { + private[chronicler] final def getOptGropedResult(js: JValue): Option[Array[(Array[String], JArray)]] = { js.get("results").arrayValue.flatMap(_.headOption) .flatMap(_.get("series").arrayValue) .map(_.flatMap(_.obj)) @@ -66,7 +87,7 @@ private[chronicler] trait JsonHandler[M[_], R] { * @param js - JSON value * @return - Array of points */ - final def getOptBulkInfluxPoints(js: JValue): Option[Array[Array[JArray]]] = { + private[chronicler] final def getOptBulkInfluxPoints(js: JValue): Option[Array[Array[JArray]]] = { js.get("results").arrayValue // get array from 'results' field .map(_.flatMap(_.get("series").arrayValue.flatMap(_.headOption))) // get head of 'series' field .map(_.flatMap(_.get("values").arrayValue.map(_.flatMap(_.array)))) // get 'values' array @@ -77,7 +98,7 @@ private[chronicler] trait JsonHandler[M[_], R] { * @param js - JSON value * @return = array of meas name -> meas points */ - final def getOptJsInfluxInfo(js: JValue): Option[Array[(String, Array[JArray])]] = { + private[chronicler] final def getOptJsInfluxInfo(js: JValue): Option[Array[(String, Array[JArray])]] = { js.get("results").arrayValue.flatMap(_.headOption) .flatMap(_.get("series").arrayValue) .map(_.flatMap(_.obj)) @@ -100,6 +121,6 @@ private[chronicler] trait JsonHandler[M[_], R] { * @tparam T - type of scala case class * @return - Array of pairs */ - final def getOptInfluxInfo[T: ClassTag](js: JValue)(implicit rd: InfluxReader[T]): Option[Array[(String, Array[T])]] = + private[chronicler] final def getOptInfluxInfo[T: ClassTag](js: JValue)(implicit rd: InfluxReader[T]): Option[Array[(String, Array[T])]] = getOptJsInfluxInfo(js).map(_.map { case (k, v) => k -> v.map(rd.read)}) } \ No newline at end of file diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/handlers/QueryHandler.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/handlers/QueryHandler.scala index 801e0083..5c9cb751 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/handlers/QueryHandler.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/handlers/QueryHandler.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.handlers import com.github.fsanaulla.chronicler.core.model.HasCredentials @@ -6,6 +22,7 @@ import scala.collection.mutable /** * Trait that define functionality for handling query building + * * @tparam A - Result type parameter, for example for AkkaHttpBackend * used `akka.http.scaladsl.model.Uri` */ @@ -13,18 +30,20 @@ private[chronicler] trait QueryHandler[A] { self: HasCredentials => /** * Method that build result URI object of type [A], from uri path, and query parameters + * * @param uri - string based uri path * @param queryParams - query parameters that will be embedded into request * @return - resulr URI object */ - def buildQuery(uri: String, queryParams: Map[String, String]): A + private[chronicler] def buildQuery(uri: String, queryParams: Map[String, String]): A /** * Method that embed credentials to already created query parameters map + * * @param queryMap - query parameters map * @return - updated query parameters map with embedded credentials */ - final def buildQueryParams(queryMap: mutable.Map[String, String]): Map[String, String] = { + private[chronicler] final def buildQueryParams(queryMap: mutable.Map[String, String]): Map[String, String] = { for { c <- credentials } yield queryMap += ("u" -> c.username, "p" -> c.password) @@ -34,9 +53,10 @@ private[chronicler] trait QueryHandler[A] { self: HasCredentials => /** * Produce query parameters map for string parameter, with embedding credentials + * * @param query - query string parameter * @return - query parameters */ - final def buildQueryParams(query: String): Map[String, String] = + private[chronicler] final def buildQueryParams(query: String): Map[String, String] = buildQueryParams(scala.collection.mutable.Map("q" -> query)) } diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/handlers/RequestHandler.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/handlers/RequestHandler.scala index 38ecb9a0..a7161592 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/handlers/RequestHandler.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/handlers/RequestHandler.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.handlers import com.github.fsanaulla.chronicler.core.model.ImplicitRequestBuilder @@ -16,5 +32,5 @@ private[chronicler] trait RequestHandler[M[_], Req, Resp, Uri] extends ImplicitR * @param request - request entity * @return - Return wrapper response */ - def execute(request: Req): M[Resp] + private[chronicler] def execute(request: Req): M[Resp] } diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/handlers/ResponseHandler.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/handlers/ResponseHandler.scala index 924bdc6e..ee52888a 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/handlers/ResponseHandler.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/handlers/ResponseHandler.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.handlers import com.github.fsanaulla.chronicler.core.model._ @@ -8,6 +24,7 @@ import scala.reflect.ClassTag /** * This trait define response handling functionality, it's provide method's that generalize * response handle flow, for every backend implementation + * * @tparam M - Container for result values. * @tparam R - Backend HTTP response type, for example for Akka HTTP backend - HttpResponse */ @@ -15,35 +32,40 @@ private[chronicler] trait ResponseHandler[M[_], R] { /** * Method for handling HTTP responses with empty body + * * @param response - backend response value * @return - Result in future container */ - def toResult(response: R): M[WriteResult] + private[chronicler] def toResult(response: R): M[WriteResult] /** * Method for handling HTTP responses with body, with on fly deserialization into JArray value + * * @param response - backaend response value * @return - Query result of JArray in future container */ - def toQueryJsResult(response: R): M[QueryResult[JArray]] + private[chronicler] def toQueryJsResult(response: R): M[QueryResult[JArray]] /** * Handling HTTP response with GROUP BY clause in the query + * * @param response - backand response * @return - grouped result */ - def toGroupedJsResult(response: R): M[GroupedResult[JArray]] + private[chronicler] def toGroupedJsResult(response: R): M[GroupedResult[JArray]] /** * Method for handling HTtp responses with non empty body, that contains multiple response. + * * deserialized into Seq[JArray] * @param response - backend response value * @return - Query result with multiple response values */ - def toBulkQueryJsResult(response: R): M[QueryResult[Array[JArray]]] + private[chronicler] def toBulkQueryJsResult(response: R): M[QueryResult[Array[JArray]]] /** * Method for handling Info based HTTP responses, with possibility for future deserialization. + * * @param response - backend response value * @param f - function that transform into value of type [B] * @param reader - influx reader @@ -51,34 +73,37 @@ private[chronicler] trait ResponseHandler[M[_], R] { * @tparam B - info object * @return - Query result of [B] in future container */ - def toComplexQueryResult[A: ClassTag, B: ClassTag](response: R, + private[chronicler] def toComplexQueryResult[A: ClassTag, B: ClassTag](response: R, f: (String, Array[A]) => B) (implicit reader: InfluxReader[A]): M[QueryResult[B]] /** * Extract HTTP response body, and transform it to A + * * @param response backend response * @param reader - influx reader * @tparam A - Deserializer entity type * @return - Query result in future container */ - def toQueryResult[A: ClassTag](response: R)(implicit reader: InfluxReader[A]): M[QueryResult[A]] + private[chronicler] def toQueryResult[A: ClassTag](response: R)(implicit reader: InfluxReader[A]): M[QueryResult[A]] /*** * Handler error codes by it's value + * * @param code - error code * @param response - response for extracting error message * @return - InfluxException wrraped in container type */ - def errorHandler(response: R, code: Int): M[InfluxException] + private[chronicler] def errorHandler(response: R, code: Int): M[InfluxException] /*** * Get CQ information from Response + * * @param response - Response object * @param reader - implicit influx reader, predefined * @return - CQ results */ - final def toCqQueryResult(response: R)(implicit reader: InfluxReader[ContinuousQuery]): M[QueryResult[ContinuousQueryInfo]] = { + private[chronicler] final def toCqQueryResult(response: R)(implicit reader: InfluxReader[ContinuousQuery]): M[QueryResult[ContinuousQueryInfo]] = { toComplexQueryResult[ContinuousQuery, ContinuousQueryInfo]( response, (name: String, arr: Array[ContinuousQuery]) => ContinuousQueryInfo(name, arr) @@ -87,11 +112,12 @@ private[chronicler] trait ResponseHandler[M[_], R] { /*** * Get Shard info information from Response + * * @param response - Response object * @param reader - implicit influx reader, predefined * @return - Shard info results */ - final def toShardQueryResult(response: R)(implicit reader: InfluxReader[Shard]): M[QueryResult[ShardInfo]] = { + private[chronicler] final def toShardQueryResult(response: R)(implicit reader: InfluxReader[Shard]): M[QueryResult[ShardInfo]] = { toComplexQueryResult[Shard, ShardInfo]( response, (name: String, arr: Array[Shard]) => ShardInfo(name, arr) @@ -100,11 +126,12 @@ private[chronicler] trait ResponseHandler[M[_], R] { /*** * Get Subscription info information from Response + * * @param response - Response object * @param reader - implicit influx reader, predefined * @return - Subscription info results */ - final def toSubscriptionQueryResult(response: R)(implicit reader: InfluxReader[Subscription]): M[QueryResult[SubscriptionInfo]] = { + private[chronicler] final def toSubscriptionQueryResult(response: R)(implicit reader: InfluxReader[Subscription]): M[QueryResult[SubscriptionInfo]] = { toComplexQueryResult[Subscription, SubscriptionInfo]( response, (name: String, arr: Array[Subscription]) => SubscriptionInfo(name, arr) @@ -113,11 +140,12 @@ private[chronicler] trait ResponseHandler[M[_], R] { /*** * Get Shard group info information from Response + * * @param response - Response object * @param reader - implicit influx reader, predefined * @return - Shard group info results */ - final def toShardGroupQueryResult(response: R)(implicit reader: InfluxReader[ShardGroup]): M[QueryResult[ShardGroupsInfo]] = { + private[chronicler] final def toShardGroupQueryResult(response: R)(implicit reader: InfluxReader[ShardGroup]): M[QueryResult[ShardGroupsInfo]] = { toComplexQueryResult[ShardGroup, ShardGroupsInfo]( response, (name: String, arr: Array[ShardGroup]) => ShardGroupsInfo(name, arr) @@ -126,8 +154,9 @@ private[chronicler] trait ResponseHandler[M[_], R] { /*** * Check response for success + * * @param code - response code * @return - is it success */ - final def isSuccessful(code: Int): Boolean = code >= 200 && code < 300 + private[chronicler] final def isSuccessful(code: Int): Boolean = code >= 200 && code < 300 } diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/io/ReadOperations.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/io/ReadOperations.scala index 4b973f81..82a3e3d9 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/io/ReadOperations.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/io/ReadOperations.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.io import com.github.fsanaulla.chronicler.core.enums.Epoch @@ -18,7 +34,7 @@ trait ReadOperations[M[_]] { * @param chunked - Chunked response * @return - Query result, array of JArray */ - def readJs(dbName: String, query: String, epoch: Epoch, pretty: Boolean, chunked: Boolean): M[ReadResult[JArray]] + private[chronicler] def readJs(dbName: String, query: String, epoch: Epoch, pretty: Boolean, chunked: Boolean): M[ReadResult[JArray]] /** * Execute several queries in one time @@ -29,6 +45,6 @@ trait ReadOperations[M[_]] { * @param chunked - Chunked response * @return - Multiple query results, array of JArray */ - def bulkReadJs(dbName: String, queries: Seq[String], epoch: Epoch, pretty: Boolean, chunked: Boolean): M[QueryResult[Array[JArray]]] + private[chronicler] def bulkReadJs(dbName: String, queries: Seq[String], epoch: Epoch, pretty: Boolean, chunked: Boolean): M[QueryResult[Array[JArray]]] } diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/io/WriteOperations.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/io/WriteOperations.scala index 29ecb083..6e0bf293 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/io/WriteOperations.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/io/WriteOperations.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.io import com.github.fsanaulla.chronicler.core.enums.{Consistency, Precision} @@ -19,12 +35,12 @@ trait WriteOperations[M[_], E] { * @param retentionPolicy - Optional retention policy name * @return - Result of execution */ - def writeTo(dbName: String, - entity: E, - consistency: Consistency, - precision: Precision, - retentionPolicy: Option[String], - gzipped: Boolean): M[WriteResult] + private[chronicler] def writeTo(dbName: String, + entity: E, + consistency: Consistency, + precision: Precision, + retentionPolicy: Option[String], + gzipped: Boolean): M[WriteResult] /** * Write points from specified file @@ -34,11 +50,11 @@ trait WriteOperations[M[_], E] { * @param retentionPolicy - optional retention policy name * @return - execution result */ - def writeFromFile(dbName: String, - filePath: String, - consistency: Consistency, - precision: Precision, - retentionPolicy: Option[String], - gzipped: Boolean): M[WriteResult] + private[chronicler] def writeFromFile(dbName: String, + filePath: String, + consistency: Consistency, + precision: Precision, + retentionPolicy: Option[String], + gzipped: Boolean): M[WriteResult] } diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/ContinuousQuerys.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/ContinuousQuerys.scala index f8db06d1..fa0d3bd8 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/ContinuousQuerys.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/ContinuousQuerys.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.query import com.github.fsanaulla.chronicler.core.handlers.QueryHandler @@ -11,14 +27,14 @@ import com.github.fsanaulla.chronicler.core.model.HasCredentials private[chronicler] trait ContinuousQuerys[U] { self: QueryHandler[U] with HasCredentials => - final def showCQQuery(): U = + private[chronicler] final def showCQQuery(): U = buildQuery("/query", buildQueryParams("SHOW CONTINUOUS QUERIES")) - final def dropCQQuery(dbName: String, cqName: String): U = { + private[chronicler] final def dropCQQuery(dbName: String, cqName: String): U = { buildQuery("/query", buildQueryParams(s"DROP CONTINUOUS QUERY $cqName ON $dbName")) } - final def createCQQuery(dbName: String, cqName: String, query: String): U = { + private[chronicler] final def createCQQuery(dbName: String, cqName: String, query: String): U = { buildQuery("/query", buildQueryParams(s"CREATE CONTINUOUS QUERY $cqName ON $dbName BEGIN $query END")) } } diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/DataManagementQuery.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/DataManagementQuery.scala index a141b758..386923f3 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/DataManagementQuery.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/DataManagementQuery.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.query import com.github.fsanaulla.chronicler.core.handlers.QueryHandler @@ -12,10 +28,10 @@ private[chronicler] trait DataManagementQuery[U] { self: QueryHandler[U] with HasCredentials => final def createDatabaseQuery(dbName: String, - duration: Option[String], - replication: Option[Int], - shardDuration: Option[String], - rpName: Option[String]): U = { + duration: Option[String], + replication: Option[Int], + shardDuration: Option[String], + rpName: Option[String]): U = { val sb = StringBuilder.newBuilder @@ -73,10 +89,10 @@ private[chronicler] trait DataManagementQuery[U] { } final def showTagKeysQuery(dbName: String, - measurementName: String, - whereClause: Option[String], - limit: Option[Int], - offset: Option[Int]): U = { + measurementName: String, + whereClause: Option[String], + limit: Option[Int], + offset: Option[Int]): U = { val sb = StringBuilder.newBuilder sb.append("SHOW TAG KEYS ON ") @@ -100,11 +116,11 @@ private[chronicler] trait DataManagementQuery[U] { } final def showTagValuesQuery(dbName: String, - measurementName: String, - withKey: Seq[String], - whereClause: Option[String], - limit: Option[Int], - offset: Option[Int]): U = { + measurementName: String, + withKey: Seq[String], + whereClause: Option[String], + limit: Option[Int], + offset: Option[Int]): U = { require(withKey.nonEmpty, "Keys can't be empty") val sb = StringBuilder.newBuilder diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/DatabaseOperationQuery.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/DatabaseOperationQuery.scala index ef5286ef..06433bc2 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/DatabaseOperationQuery.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/DatabaseOperationQuery.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.query import com.github.fsanaulla.chronicler.core.enums.{Consistency, Epoch, Precision} @@ -14,10 +30,10 @@ import scala.collection.mutable private[chronicler] trait DatabaseOperationQuery[U] { self: QueryHandler[U] with HasCredentials => - final def writeToInfluxQuery(dbName: String, - consistency: Consistency, - precision: Precision, - retentionPolicy: Option[String]): U = { + private[chronicler] final def writeToInfluxQuery(dbName: String, + consistency: Consistency, + precision: Precision, + retentionPolicy: Option[String]): U = { val queryParams = scala.collection.mutable.Map[String, String]( "db" -> dbName, @@ -32,11 +48,11 @@ private[chronicler] trait DatabaseOperationQuery[U] { buildQuery("/write", buildQueryParams(queryParams)) } - final def readFromInfluxSingleQuery(dbName: String, - query: String, - epoch: Epoch, - pretty: Boolean, - chunked: Boolean): U = { + private[chronicler] final def readFromInfluxSingleQuery(dbName: String, + query: String, + epoch: Epoch, + pretty: Boolean, + chunked: Boolean): U = { val queryParams = scala.collection.mutable.Map[String, String]( "db" -> dbName, @@ -49,11 +65,11 @@ private[chronicler] trait DatabaseOperationQuery[U] { buildQuery("/query", buildQueryParams(queryParams)) } - final def readFromInfluxBulkQuery(dbName: String, - queries: Seq[String], - epoch: Epoch, - pretty: Boolean, - chunked: Boolean): U = { + private[chronicler] final def readFromInfluxBulkQuery(dbName: String, + queries: Seq[String], + epoch: Epoch, + pretty: Boolean, + chunked: Boolean): U = { val queryParams = mutable.Map[String, String]( "db" -> dbName, "pretty" -> pretty.toString, diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/QuerysManagementQuery.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/QuerysManagementQuery.scala index 401a4a34..d5c32b66 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/QuerysManagementQuery.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/QuerysManagementQuery.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.query import com.github.fsanaulla.chronicler.core.handlers.QueryHandler @@ -11,12 +27,11 @@ import com.github.fsanaulla.chronicler.core.model.HasCredentials private[chronicler] trait QuerysManagementQuery[U] { self: QueryHandler[U] with HasCredentials => - final def showQuerysQuery(): U = { + private[chronicler] final def showQuerysQuery(): U = { buildQuery("/query", buildQueryParams("SHOW QUERIES")) } - final def killQueryQuery(queryId: Int): U = { + private[chronicler] final def killQueryQuery(queryId: Int): U = { buildQuery("/query", buildQueryParams(s"KILL QUERY $queryId")) } - } diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/RetentionPolicyManagementQuery.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/RetentionPolicyManagementQuery.scala index 7523321a..6466169d 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/RetentionPolicyManagementQuery.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/RetentionPolicyManagementQuery.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.query import com.github.fsanaulla.chronicler.core.handlers.QueryHandler @@ -8,12 +24,12 @@ import scala.collection.mutable private[chronicler] trait RetentionPolicyManagementQuery[U] { self: QueryHandler[U] with HasCredentials => - final def createRetentionPolicyQuery(rpName: String, - dbName: String, - duration: String, - replication: Int, - shardDuration: Option[String], - default: Boolean = false): U = { + private[chronicler] final def createRetentionPolicyQuery(rpName: String, + dbName: String, + duration: String, + replication: Int, + shardDuration: Option[String], + default: Boolean = false): U = { val sb = StringBuilder.newBuilder sb.append("CREATE RETENTION POLICY ") @@ -34,15 +50,15 @@ private[chronicler] trait RetentionPolicyManagementQuery[U] { buildQuery("/query", buildQueryParams(sb.toString())) } - final def dropRetentionPolicyQuery(rpName: String, dbName: String): U = + private[chronicler] final def dropRetentionPolicyQuery(rpName: String, dbName: String): U = buildQuery("/query", buildQueryParams(s"DROP RETENTION POLICY $rpName ON $dbName")) - final def updateRetentionPolicyQuery(rpName: String, - dbName: String, - duration: Option[String], - replication: Option[Int], - shardDuration: Option[String], - default: Boolean = false): U = { + private[chronicler] final def updateRetentionPolicyQuery(rpName: String, + dbName: String, + duration: Option[String], + replication: Option[Int], + shardDuration: Option[String], + default: Boolean = false): U = { val sb = StringBuilder.newBuilder sb.append("ALTER RETENTION POLICY ") @@ -67,6 +83,6 @@ private[chronicler] trait RetentionPolicyManagementQuery[U] { buildQuery("/query", buildQueryParams(sb.toString())) } - final def showRetentionPoliciesQuery(dbName: String): U = + private[chronicler] final def showRetentionPoliciesQuery(dbName: String): U = buildQuery("/query", buildQueryParams(mutable.Map("db" -> dbName, "q" -> "SHOW RETENTION POLICIES"))) } diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/ShardManagementQuery.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/ShardManagementQuery.scala index 5efb4f97..0b13473b 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/ShardManagementQuery.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/ShardManagementQuery.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.query import com.github.fsanaulla.chronicler.core.handlers.QueryHandler @@ -11,15 +27,15 @@ import com.github.fsanaulla.chronicler.core.model.HasCredentials private[chronicler] trait ShardManagementQuery[U] { self: QueryHandler[U] with HasCredentials => - final def dropShardQuery(shardId: Int): U = { + private[chronicler] final def dropShardQuery(shardId: Int): U = { buildQuery("/query", buildQueryParams(s"DROP SHARD $shardId")) } - final def showShardsQuery(): U = { + private[chronicler] final def showShardsQuery(): U = { buildQuery("/query", buildQueryParams("SHOW SHARDS")) } - final def showShardGroupsQuery(): U = { + private[chronicler] final def showShardGroupsQuery(): U = { buildQuery("/query", buildQueryParams("SHOW SHARD GROUPS")) } diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/SubscriptionsManagementQuery.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/SubscriptionsManagementQuery.scala index ad5b5f4f..21be8e4f 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/SubscriptionsManagementQuery.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/SubscriptionsManagementQuery.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.query import com.github.fsanaulla.chronicler.core.enums.Destination @@ -12,23 +28,23 @@ import com.github.fsanaulla.chronicler.core.model.HasCredentials private[chronicler] trait SubscriptionsManagementQuery[U] { self: QueryHandler[U] with HasCredentials => - final def createSubscriptionQuery(subsName: String, - dbName: String, - rpName: String, - destinationType: Destination, - addresses: Seq[String]): U = { + private[chronicler] final def createSubscriptionQuery(subsName: String, + dbName: String, + rpName: String, + destinationType: Destination, + addresses: Seq[String]): U = { val addressesStr = addresses.map(str => s"\'$str\'").mkString(", ") buildQuery("/query", buildQueryParams(s"CREATE SUBSCRIPTION $subsName ON $dbName.$rpName DESTINATIONS $destinationType $addressesStr")) } - final def dropSubscriptionQuery(subsName: String, - dbName: String, - rpName: String): U = + private[chronicler] final def dropSubscriptionQuery(subsName: String, + dbName: String, + rpName: String): U = buildQuery("/query", buildQueryParams(s"DROP SUBSCRIPTION $subsName ON $dbName.$rpName")) - final def showSubscriptionsQuery(): U = + private[chronicler] final def showSubscriptionsQuery(): U = buildQuery("/query", buildQueryParams("SHOW SUBSCRIPTIONS")) } diff --git a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/UserManagementQuery.scala b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/UserManagementQuery.scala index e9b9dd06..8e5b5018 100644 --- a/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/UserManagementQuery.scala +++ b/core/core-api/src/main/scala/com/github/fsanaulla/chronicler/core/query/UserManagementQuery.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.query import com.github.fsanaulla.chronicler.core.enums.Privilege @@ -7,45 +23,45 @@ import com.github.fsanaulla.chronicler.core.model.HasCredentials private[fsanaulla] trait UserManagementQuery[U] { self: QueryHandler[U] with HasCredentials => - final def showUsersQuery(): U = + private[chronicler] final def showUsersQuery(): U = buildQuery("/query", buildQueryParams("SHOW USERS")) - final def showUserPrivilegesQuery(username: String): U = + private[chronicler] final def showUserPrivilegesQuery(username: String): U = buildQuery("/query", buildQueryParams(s"SHOW GRANTS FOR $username")) - final def setUserPasswordQuery(username: String, password: String): U = + private[chronicler] final def setUserPasswordQuery(username: String, password: String): U = buildQuery("/query", buildQueryParams(s"SET PASSWORD FOR $username = '$password'")) - final def createAdminQuery(username: String, password: String): U = + private[chronicler] final def createAdminQuery(username: String, password: String): U = buildQuery("/query", buildQueryParams(s"CREATE USER $username WITH PASSWORD '$password' WITH ALL PRIVILEGES")) - final def makeAdminQuery(username: String): U = + private[chronicler] final def makeAdminQuery(username: String): U = buildQuery("/query", buildQueryParams(s"GRANT ALL PRIVILEGES TO $username")) - final def disableAdminQuery(username: String): U = + private[chronicler] final def disableAdminQuery(username: String): U = buildQuery("/query", buildQueryParams(s"REVOKE ALL PRIVILEGES FROM $username")) - final def createUserQuery(username: String, password: String): U = + private[chronicler] final def createUserQuery(username: String, password: String): U = buildQuery("/query", buildQueryParams(s"CREATE USER $username WITH PASSWORD '$password'")) - final def dropUserQuery(username: String): U = + private[chronicler] final def dropUserQuery(username: String): U = buildQuery("/query", buildQueryParams(s"DROP USER $username")) - final def setPrivilegesQuery(dbName: String, + private[chronicler] final def setPrivilegesQuery(dbName: String, username: String, privileges: Privilege): U = buildQuery("/query", buildQueryParams(s"GRANT $privileges ON $dbName TO $username")) - final def revokePrivilegesQuery(dbName: String, + private[chronicler] final def revokePrivilegesQuery(dbName: String, username: String, privileges: Privilege): U = buildQuery("/query", buildQueryParams(s"REVOKE $privileges ON $dbName FROM $username")) diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Consistencies.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Consistencies.scala index fb730da6..6b3d0f99 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Consistencies.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Consistencies.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.enums import enumeratum.EnumEntry @@ -9,15 +25,16 @@ import scala.collection.immutable * Author: fayaz.sanaulla@gmail.com * Date: 29.07.17 */ -sealed abstract class Consistency(override val entryName: String) extends EnumEntry { +sealed abstract class Consistency extends EnumEntry { override def toString: String = entryName } object Consistencies extends enumeratum.Enum[Consistency]{ val values: immutable.IndexedSeq[Consistency] = findValues - case object ONE extends Consistency("one") - case object QUORUM extends Consistency("quorum") - case object ALL extends Consistency("all") - case object ANY extends Consistency("any") + case object ONE extends Consistency { override val entryName: String = "one" } + case object QUORUM extends Consistency { override val entryName: String = "quorum" } + case object ALL extends Consistency { override val entryName: String = "all" } + case object ANY extends Consistency { override val entryName: String = "any" } } + diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Destinations.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Destinations.scala index aad7474c..91a10122 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Destinations.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Destinations.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.enums import enumeratum.EnumEntry diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Epochs.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Epochs.scala index 62b6ed49..ab2557b0 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Epochs.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Epochs.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.enums import enumeratum.EnumEntry @@ -9,17 +25,17 @@ import scala.collection.immutable * Author: fayaz.sanaulla@gmail.com * Date: 29.07.17 */ -sealed abstract class Epoch(override val entryName: String) extends EnumEntry { +sealed abstract class Epoch extends EnumEntry { override def toString: String = entryName } object Epochs extends enumeratum.Enum[Epoch] { val values: immutable.IndexedSeq[Epoch] = findValues - case object NANOSECONDS extends Epoch("ns") - case object MICROSECONDS extends Epoch("u") - case object MILLISECONDS extends Epoch("ms") - case object SECONDS extends Epoch("s") - case object MINUTES extends Epoch("m") - case object HOURS extends Epoch("h") + case object NANOSECONDS extends Epoch { override val entryName: String = "ns" } + case object MICROSECONDS extends Epoch { override val entryName: String = "u" } + case object MILLISECONDS extends Epoch { override val entryName: String = "ms" } + case object SECONDS extends Epoch { override val entryName: String = "s" } + case object MINUTES extends Epoch { override val entryName: String = "m" } + case object HOURS extends Epoch { override val entryName: String = "h" } } diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Precisions.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Precisions.scala index 86f979e1..b29f7b1e 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Precisions.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Precisions.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.enums import enumeratum.EnumEntry diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Privileges.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Privileges.scala index ae85cc3d..d158c6aa 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Privileges.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/enums/Privileges.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.enums import enumeratum.EnumEntry diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/Executable.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/Executable.scala index 44907931..3ccb614d 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/Executable.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/Executable.scala @@ -1,10 +1,26 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.model import scala.concurrent.ExecutionContext /** Trait for mixin execution context */ -trait Executable { +private[chronicler] trait Executable { /** Implicit execution context */ - protected implicit val ex: ExecutionContext + private[chronicler] implicit val ex: ExecutionContext } diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/HasCredentials.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/HasCredentials.scala index 21f609cf..8beba6bf 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/HasCredentials.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/HasCredentials.scala @@ -1,8 +1,22 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.model -/** - * Define functionality for using credentials in the context - */ -trait HasCredentials { - protected val credentials: Option[InfluxCredentials] +/** Define functionality for using credentials in the context */ +private[chronicler] trait HasCredentials { + private[chronicler] val credentials: Option[InfluxCredentials] } diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/ImplicitRequestBuilder.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/ImplicitRequestBuilder.scala index bb7e6fd2..eb7a9582 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/ImplicitRequestBuilder.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/ImplicitRequestBuilder.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.model /** @@ -13,5 +29,5 @@ trait ImplicitRequestBuilder[Uri, Request] { * @param uri - Uri parameter * @return - request entity */ - implicit def req(uri: Uri): Request + private[chronicler] implicit def req(uri: Uri): Request } diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxConfig.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxConfig.scala index ea47e849..c3258562 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxConfig.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxConfig.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.model /** Configuration file for simplify cooperation with influx */ diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxCredentials.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxCredentials.scala index fa61b257..a6aa0bec 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxCredentials.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxCredentials.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.model /** diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxException.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxException.scala index 8bea2d92..127c73a3 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxException.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxException.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.model /** diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxFormatter.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxFormatter.scala index 38a8749e..6f8b9157 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxFormatter.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxFormatter.scala @@ -1,5 +1,23 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.model +import java.io.{Serializable => JSerializable} + import jawn.ast.JArray import scala.annotation.implicitNotFound @@ -7,7 +25,7 @@ import scala.annotation.implicitNotFound @implicitNotFound( "No InfluxFormatter found for type ${T}. Try to implement an implicit Format for this type." ) -trait InfluxFormatter[T] extends InfluxReader[T] with InfluxWriter[T] +trait InfluxFormatter[T] extends InfluxWriter[T] with InfluxReader[T] /** * Return string must be in following format @@ -17,7 +35,7 @@ trait InfluxFormatter[T] extends InfluxReader[T] with InfluxWriter[T] @implicitNotFound( "No InfluxWriter found for type ${T}. Try to implement an implicit Writable for this type." ) -trait InfluxWriter[T] { +trait InfluxWriter[T] extends JSerializable { def write(obj: T): String } @@ -27,6 +45,6 @@ trait InfluxWriter[T] { @implicitNotFound( "No InfluxReader found for type ${T}. Try to implement an implicit Readable for this type." ) -trait InfluxReader[T] { +trait InfluxReader[T] extends JSerializable { def read(js: JArray): T } diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxModels.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxModels.scala index eaf58224..cd7e1728 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxModels.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxModels.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.model import com.github.fsanaulla.chronicler.core.enums.{Destination, Privilege} diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxPoint.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxPoint.scala index 51b1545f..608eaf6e 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxPoint.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxPoint.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.model /** diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxResult.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxResult.scala index a1bc88cb..81bf42c9 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxResult.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/InfluxResult.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.model import scala.concurrent.Future diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/Mappable.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/Mappable.scala index 093c8f68..bae658d1 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/Mappable.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/Mappable.scala @@ -1,7 +1,23 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.model /** Mixing mapper to context*/ -trait Mappable[M[_], R] { +private[chronicler] trait Mappable[M[_], R] { /** * Map execution result to InfluxResult @@ -10,5 +26,5 @@ trait Mappable[M[_], R] { * @tparam B - ressult type * @return - result wrapped in input container */ - def mapTo[B](resp: M[R], f: R => M[B]): M[B] + private[chronicler] def mapTo[B](resp: M[R], f: R => M[B]): M[B] } diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/PointTransformer.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/PointTransformer.scala index 3323e19d..0603b296 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/PointTransformer.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/PointTransformer.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.model /** diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/Serializable.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/Serializable.scala index 9333a1e3..1b490cbf 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/Serializable.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/Serializable.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.model trait Serializable[To] { diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/Serializer.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/Serializer.scala index 86af549d..1d4b0e3f 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/Serializer.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/Serializer.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.model /** diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/UdpConnection.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/UdpConnection.scala index 791f1782..24e87785 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/UdpConnection.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/model/UdpConnection.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.model import java.net.InetAddress diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/DefaultInfluxImplicits.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/DefaultInfluxImplicits.scala index a7468931..064a9f68 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/DefaultInfluxImplicits.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/DefaultInfluxImplicits.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.utils import com.github.fsanaulla.chronicler.core.enums.{Destinations, Privileges} diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/Encodings.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/Encodings.scala index 9d4ae898..8a169dd7 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/Encodings.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/Encodings.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.utils object Encodings { diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/Extensions.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/Extensions.scala index c05bd957..7dde7cc8 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/Extensions.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/Extensions.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.utils import jawn.ast.{JArray, JObject, JValue} @@ -5,7 +21,7 @@ import jawn.ast.{JArray, JObject, JValue} private[fsanaulla] object Extensions { /** Extension to simplify parsing JAWN AST */ - implicit class RichJValue(private val jv: JValue) extends AnyVal { + implicit final class RichJValue(private val jv: JValue) extends AnyVal { def arrayValue: Option[Array[JValue]] = jv match { case JArray(arr) => Some(arr) case _ => None diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/InfluxDuration.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/InfluxDuration.scala index 25210084..0bb0ab3d 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/InfluxDuration.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/InfluxDuration.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.utils /** diff --git a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/PrimitiveJawnImplicits.scala b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/PrimitiveJawnImplicits.scala index 0a6c02ae..b84a376b 100644 --- a/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/PrimitiveJawnImplicits.scala +++ b/core/core-model/src/main/scala/com/github/fsanaulla/chronicler/core/utils/PrimitiveJawnImplicits.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.core.utils import jawn.ast.JValue diff --git a/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/Macros.scala b/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/Macros.scala index 89cf6465..9478b2c5 100644 --- a/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/Macros.scala +++ b/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/Macros.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.macros import com.github.fsanaulla.chronicler.core.model.{InfluxFormatter, InfluxReader, InfluxWriter} @@ -8,10 +24,13 @@ import scala.language.experimental.macros * Provide all necessary method for compile-time code generation */ object Macros { + /** Generate InfluxWriter for type A */ def writer[A]: InfluxWriter[A] = macro MacrosImpl.writer_impl[A] + /** Generate InfluxReader for type A */ def reader[A]: InfluxReader[A] = macro MacrosImpl.reader_impl[A] + /** Generate InfluxFormatter for type A */ def format[A]: InfluxFormatter[A] = macro MacrosImpl.format_impl[A] } diff --git a/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/MacrosImpl.scala b/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/MacrosImpl.scala index 347443c9..9e182569 100644 --- a/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/MacrosImpl.scala +++ b/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/MacrosImpl.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.macros import com.github.fsanaulla.chronicler.macros.annotations.{field, tag, timestamp} diff --git a/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/annotations/field.scala b/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/annotations/field.scala index 775bc431..a8f66a36 100644 --- a/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/annotations/field.scala +++ b/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/annotations/field.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.macros.annotations /*** diff --git a/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/annotations/tag.scala b/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/annotations/tag.scala index d210ce69..dff700ec 100644 --- a/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/annotations/tag.scala +++ b/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/annotations/tag.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.macros.annotations /*** diff --git a/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/annotations/timestamp.scala b/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/annotations/timestamp.scala index c528e82e..adec8c73 100644 --- a/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/annotations/timestamp.scala +++ b/macros/src/main/scala/com/github/fsanaulla/chronicler/macros/annotations/timestamp.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.macros.annotations /** Mark field that will be used as timestamp in InfluxDB. diff --git a/project/Dependencies.scala b/project/Dependencies.scala index ce3691a0..e3039863 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -10,7 +10,7 @@ object Dependencies { object Versions { val sttp = "1.1.14" val netty = "4.1.22.Final" - val testing = "0.3.0" + val testing = "0.3.1" object Akka { val akka = "2.5.12" diff --git a/project/Settings.scala b/project/Settings.scala index 692c00ff..a625726f 100644 --- a/project/Settings.scala +++ b/project/Settings.scala @@ -1,4 +1,6 @@ import com.typesafe.sbt.SbtPgp.autoImportImpl.useGpg +import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport.headerLicense +import de.heikoseeberger.sbtheader.License import sbt.Keys._ import sbt.librarymanagement.LibraryManagementSyntax import sbt.{Developer, Opts, ScmInfo, url} @@ -6,22 +8,36 @@ import sbt.{Developer, Opts, ScmInfo, url} /** Basic sbt settings */ object Settings extends LibraryManagementSyntax { + private val apacheUrl = "https://www.apache.org/licenses/LICENSE-2.0.txt" + + private object Owner { + val id = "fsanaulla" + val name = "Faiaz Sanaulla" + val email = "fayaz.sanaulla@gmail.com" + val github = "https://github.com/fsanaulla" + } + val common = Seq( scalaVersion := "2.12.6", organization := "com.github.fsanaulla", scalacOptions ++= Scalac.options(scalaVersion.value), crossScalaVersions := Seq("2.11.8", scalaVersion.value), homepage := Some(url("https://github.com/fsanaulla/chronicler")), - licenses += "Apache-2.0" -> url("https://opensource.org/licenses/Apache-2.0"), - developers += Developer(id = "fsanaulla", name = "Faiaz Sanaulla", email = "fayaz.sanaulla@gmail.com", url = url("https://github.com/fsanaulla")), + licenses += "Apache-2.0" -> url(apacheUrl), + developers += Developer( + id = Owner.id, + name = Owner.name, + email = Owner.email, + url = url(Owner.github) + ), parallelExecution in IntegrationTest := false, - publishArtifact in IntegrationTest := false + publishArtifact in IntegrationTest := false, + publishArtifact in Test := false ) val publish = Seq( useGpg := true, - publishArtifact in Test := false, scmInfo := Some( ScmInfo( url("https://github.com/fsanaulla/chronicler"), @@ -36,4 +52,6 @@ object Settings extends LibraryManagementSyntax { Opts.resolver.sonatypeStaging ) ) + + val header = headerLicense := Some(License.ALv2("2017-2018", Owner.name)) } diff --git a/project/plugins.sbt b/project/plugins.sbt index f5cfdad9..0f8113a9 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,4 @@ addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") -addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.0") -addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0") \ No newline at end of file +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3") +addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1") +addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.0.0") \ No newline at end of file diff --git a/udp/src/main/scala/com/github/fsanaulla/chronicler/udp/Influx.scala b/udp/src/main/scala/com/github/fsanaulla/chronicler/udp/Influx.scala index 5581554f..61e3cc48 100644 --- a/udp/src/main/scala/com/github/fsanaulla/chronicler/udp/Influx.scala +++ b/udp/src/main/scala/com/github/fsanaulla/chronicler/udp/Influx.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.udp /** diff --git a/udp/src/main/scala/com/github/fsanaulla/chronicler/udp/InfluxUDPClient.scala b/udp/src/main/scala/com/github/fsanaulla/chronicler/udp/InfluxUDPClient.scala index 18ec1f7c..9974361d 100644 --- a/udp/src/main/scala/com/github/fsanaulla/chronicler/udp/InfluxUDPClient.scala +++ b/udp/src/main/scala/com/github/fsanaulla/chronicler/udp/InfluxUDPClient.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.udp import java.io.File diff --git a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/Influx.scala b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/Influx.scala index 2f10c679..81ab4d5a 100644 --- a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/Influx.scala +++ b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/Influx.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp import com.github.fsanaulla.chronicler.core.model.{InfluxConfig, InfluxCredentials} diff --git a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/api/Database.scala b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/api/Database.scala index e05d1f85..dd4d4aef 100644 --- a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/api/Database.scala +++ b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/api/Database.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.api import com.github.fsanaulla.chronicler.core.api.DatabaseIO @@ -11,12 +27,12 @@ import jawn.ast.JArray import scala.reflect.ClassTag import scala.util.Try -final class Database(val host: String, - val port: Int, - val credentials: Option[InfluxCredentials], +final class Database(private[urlhttp] val host: String, + private[urlhttp] val port: Int, + private[chronicler] val credentials: Option[InfluxCredentials], dbName: String, gzipped: Boolean) - (protected implicit val backend: SttpBackend[Try, Nothing]) + (private[urlhttp] implicit val backend: SttpBackend[Try, Nothing]) extends DatabaseIO[Try, String](dbName) with HasCredentials with Serializable[String] @@ -53,12 +69,10 @@ final class Database(val host: String, retentionPolicy: Option[String] = None): Try[WriteResult] = writeTo(dbName, points, consistency, precision, retentionPolicy, gzipped) - override def read[A: ClassTag]( - query: String, - epoch: Epoch, - pretty: Boolean, - chunked: Boolean) - (implicit reader: InfluxReader[A]): Try[ReadResult[A]] = { + override def read[A: ClassTag](query: String, + epoch: Epoch, + pretty: Boolean, + chunked: Boolean)(implicit reader: InfluxReader[A]): Try[ReadResult[A]] = { readJs(query, epoch, pretty, chunked) map { case qr: QueryResult[JArray] => qr.map(reader.read) case gr: GroupedResult[JArray] => gr.map(reader.read) diff --git a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/api/Measurement.scala b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/api/Measurement.scala index 44b201d4..0073214d 100644 --- a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/api/Measurement.scala +++ b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/api/Measurement.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.api import com.github.fsanaulla.chronicler.core.api.MeasurementIO @@ -10,13 +26,13 @@ import jawn.ast.JArray import scala.reflect.ClassTag import scala.util.Try -final class Measurement[E: ClassTag](val host: String, - val port: Int, - val credentials: Option[InfluxCredentials], +final class Measurement[E: ClassTag](private[urlhttp] val host: String, + private[urlhttp] val port: Int, + private[chronicler] val credentials: Option[InfluxCredentials], dbName: String, measurementName: String, gzipped: Boolean) - (protected implicit val backend: SttpBackend[Try, Nothing]) + (private[urlhttp] implicit val backend: SttpBackend[Try, Nothing]) extends MeasurementIO[Try, E, String] with HasCredentials with UrlWriter diff --git a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/clients/UrlFullClient.scala b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/clients/UrlFullClient.scala index 104baa86..aeefecd2 100644 --- a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/clients/UrlFullClient.scala +++ b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/clients/UrlFullClient.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.clients import com.github.fsanaulla.chronicler.core.client.FullClient @@ -22,11 +38,11 @@ final class UrlFullClient(val host: String, with Mappable[Try, Response[JValue]] with AutoCloseable { - override def mapTo[B](resp: Try[Response[JValue]], - f: Response[JValue] => Try[B]): Try[B] = - resp.flatMap(f) + private[chronicler] override def mapTo[B](resp: Try[Response[JValue]], + f: Response[JValue] => Try[B]): Try[B] = resp.flatMap(f) - protected implicit val backend: SttpBackend[Try, Nothing] = TryHttpURLConnectionBackend() + private[urlhttp] implicit val backend: SttpBackend[Try, Nothing] = + TryHttpURLConnectionBackend() override def database(dbName: String): Database = new Database(host, port, credentials, dbName, gzipped) diff --git a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/clients/UrlIOClient.scala b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/clients/UrlIOClient.scala index 03006f43..c6025e47 100644 --- a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/clients/UrlIOClient.scala +++ b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/clients/UrlIOClient.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.clients import com.github.fsanaulla.chronicler.core.client.IOClient @@ -8,13 +24,13 @@ import com.softwaremill.sttp.{SttpBackend, TryHttpURLConnectionBackend} import scala.reflect.ClassTag import scala.util.Try -class UrlIOClient(val host: String, - val port: Int, - val credentials: Option[InfluxCredentials], - gzipped: Boolean) +final class UrlIOClient(val host: String, + val port: Int, + val credentials: Option[InfluxCredentials], + gzipped: Boolean) extends IOClient[Try, String] with AutoCloseable { - protected implicit val backend: SttpBackend[Try, Nothing] = + private[urlhttp] implicit val backend: SttpBackend[Try, Nothing] = TryHttpURLConnectionBackend() override def database(dbName: String): Database = diff --git a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/clients/UrlManagementClient.scala b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/clients/UrlManagementClient.scala index b8e09c3e..d8f62daa 100644 --- a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/clients/UrlManagementClient.scala +++ b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/clients/UrlManagementClient.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.clients import com.github.fsanaulla.chronicler.core.client.ManagementClient @@ -9,9 +25,9 @@ import jawn.ast.JValue import scala.util.Try -class UrlManagementClient(val host: String, - val port: Int, - val credentials: Option[InfluxCredentials]) +final class UrlManagementClient(val host: String, + val port: Int, + val credentials: Option[InfluxCredentials]) extends ManagementClient [Try, Request, Response[JValue], Uri, String] with UrlRequestHandler with UrlResponseHandler @@ -19,11 +35,11 @@ class UrlManagementClient(val host: String, with Mappable[Try, Response[JValue]] with AutoCloseable { - override protected implicit val backend: SttpBackend[Try, Nothing] = + private[urlhttp] override implicit val backend: SttpBackend[Try, Nothing] = TryHttpURLConnectionBackend() - override def mapTo[B](resp: Try[Response[JValue]], f: Response[JValue] => Try[B]): Try[B] = - resp.flatMap(f) + private[chronicler] override def mapTo[B](resp: Try[Response[JValue]], + f: Response[JValue] => Try[B]): Try[B] = resp.flatMap(f) override def ping: Try[WriteResult] = execute(buildQuery("/ping", Map.empty[String, String])).flatMap(toResult) diff --git a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlJsonHandler.scala b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlJsonHandler.scala index 8cf5248b..d876f7ba 100644 --- a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlJsonHandler.scala +++ b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlJsonHandler.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.handlers import com.github.fsanaulla.chronicler.core.handlers.JsonHandler @@ -9,15 +25,15 @@ import scala.util.{Success, Try} private[urlhttp] trait UrlJsonHandler extends JsonHandler[Try, Response[JValue]] { - override def getResponseBody(response: Response[JValue]): Try[JValue] = response.body match { + private[chronicler] override def getResponseBody(response: Response[JValue]): Try[JValue] = response.body match { case Right(js) => Success(js) case Left(str) => JParser.parseFromString(str) } - override def getResponseError(response: Response[JValue]): Try[String] = + private[chronicler] override def getResponseError(response: Response[JValue]): Try[String] = getResponseBody(response).map(_.get("error").asString) - override def getOptResponseError(response: Response[JValue]): Try[Option[String]] = + private[chronicler] override def getOptResponseError(response: Response[JValue]): Try[Option[String]] = getResponseBody(response) .map(_.get("results").arrayValue.flatMap(_.headOption)) .map(_.flatMap(_.get("error").getString)) diff --git a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlQueryHandler.scala b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlQueryHandler.scala index aa3f1a78..0c9af726 100644 --- a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlQueryHandler.scala +++ b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlQueryHandler.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.handlers import com.github.fsanaulla.chronicler.core.handlers.QueryHandler @@ -10,10 +26,10 @@ import scala.annotation.tailrec private[urlhttp] trait UrlQueryHandler extends QueryHandler[Uri] with HasCredentials { - protected val host: String - protected val port: Int + private[urlhttp] val host: String + private[urlhttp] val port: Int - override def buildQuery(uri: String, queryParams: Map[String, String]): Uri = { + private[chronicler] override def buildQuery(uri: String, queryParams: Map[String, String]): Uri = { val u = Uri(host = host, port).path(uri) val encoding = Uri.QueryFragmentEncoding.All val kvLst = queryParams.map { diff --git a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlRequestHandler.scala b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlRequestHandler.scala index b1cb077a..2477a33b 100644 --- a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlRequestHandler.scala +++ b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlRequestHandler.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.handlers import com.github.fsanaulla.chronicler.core.handlers.RequestHandler @@ -10,8 +26,8 @@ import scala.language.implicitConversions import scala.util.Try private[urlhttp] trait UrlRequestHandler extends RequestHandler[Try, Request, Response[JValue], Uri] { - protected implicit val backend: SttpBackend[Try, Nothing] + private[urlhttp] implicit val backend: SttpBackend[Try, Nothing] - override implicit def req(uri: Uri): Request = sttp.get(uri).response(asJson) - override def execute(request: Request): Try[Response[JValue]] = request.send() + private[chronicler] override implicit def req(uri: Uri): Request = sttp.get(uri).response(asJson) + private[chronicler] override def execute(request: Request): Try[Response[JValue]] = request.send() } diff --git a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlResponseHandler.scala b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlResponseHandler.scala index 8b5f0c20..670887e7 100644 --- a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlResponseHandler.scala +++ b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlResponseHandler.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.handlers import com.github.fsanaulla.chronicler.core.handlers.ResponseHandler @@ -10,7 +26,7 @@ import scala.util.Try private[urlhttp] trait UrlResponseHandler extends ResponseHandler[Try, Response[JValue]] with UrlJsonHandler { - override def toResult(response: Response[JValue]): Try[WriteResult] = { + private[chronicler] override def toResult(response: Response[JValue]): Try[WriteResult] = { response.code match { case code if isSuccessful(code) && code != 204 => getOptResponseError(response) map { @@ -27,7 +43,7 @@ private[urlhttp] trait UrlResponseHandler extends ResponseHandler[Try, Response[ } } - override def toComplexQueryResult[A: ClassTag, B: ClassTag]( + private[chronicler] override def toComplexQueryResult[A: ClassTag, B: ClassTag]( response: Response[JValue], f: (String, Array[A]) => B) (implicit reader: InfluxReader[A]): Try[QueryResult[B]] = { @@ -47,7 +63,7 @@ private[urlhttp] trait UrlResponseHandler extends ResponseHandler[Try, Response[ } } - override def toQueryJsResult(response: Response[JValue]): Try[QueryResult[JArray]] = { + private[chronicler] override def toQueryJsResult(response: Response[JValue]): Try[QueryResult[JArray]] = { response.code.intValue() match { case code if isSuccessful(code) => getResponseBody(response) @@ -61,7 +77,7 @@ private[urlhttp] trait UrlResponseHandler extends ResponseHandler[Try, Response[ } } - override def toGroupedJsResult(response: Response[JValue]): Try[GroupedResult[JArray]] = { + private[chronicler] override def toGroupedJsResult(response: Response[JValue]): Try[GroupedResult[JArray]] = { response.code.intValue() match { case code if isSuccessful(code) => getResponseBody(response) @@ -75,7 +91,7 @@ private[urlhttp] trait UrlResponseHandler extends ResponseHandler[Try, Response[ } } - override def toBulkQueryJsResult(response: Response[JValue]): Try[QueryResult[Array[JArray]]] = { + private[chronicler] override def toBulkQueryJsResult(response: Response[JValue]): Try[QueryResult[Array[JArray]]] = { response.code.intValue() match { case code if isSuccessful(code) => getResponseBody(response) @@ -90,11 +106,11 @@ private[urlhttp] trait UrlResponseHandler extends ResponseHandler[Try, Response[ } } - override def toQueryResult[A: ClassTag](response: Response[JValue])(implicit reader: InfluxReader[A]): Try[QueryResult[A]] = + private[chronicler] override def toQueryResult[A: ClassTag](response: Response[JValue])(implicit reader: InfluxReader[A]): Try[QueryResult[A]] = toQueryJsResult(response).map(_.map(reader.read)) - override def errorHandler(response: Response[JValue], code: Int): Try[InfluxException] = code match { + private[chronicler] override def errorHandler(response: Response[JValue], code: Int): Try[InfluxException] = code match { case 400 => getResponseError(response).map(errMsg => new BadRequestException(errMsg)) case 401 => diff --git a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/io/UrlReader.scala b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/io/UrlReader.scala index 0298c352..1f596dad 100644 --- a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/io/UrlReader.scala +++ b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/io/UrlReader.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.io import com.github.fsanaulla.chronicler.core.enums.Epoch @@ -17,7 +33,7 @@ private[urlhttp] trait UrlReader with DatabaseOperationQuery[Uri] with HasCredentials { self: ReadOperations[Try] => - override def readJs(dbName: String, + private[chronicler] override def readJs(dbName: String, query: String, epoch: Epoch, pretty: Boolean, @@ -30,11 +46,11 @@ private[urlhttp] trait UrlReader } } - override def bulkReadJs(dbName: String, - queries: Seq[String], - epoch: Epoch, - pretty: Boolean, - chunked: Boolean): Try[QueryResult[Array[JArray]]] = { + private[chronicler] override def bulkReadJs(dbName: String, + queries: Seq[String], + epoch: Epoch, + pretty: Boolean, + chunked: Boolean): Try[QueryResult[Array[JArray]]] = { val query = readFromInfluxBulkQuery(dbName, queries, epoch, pretty, chunked) execute(query).flatMap(toBulkQueryJsResult) } diff --git a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/io/UrlWriter.scala b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/io/UrlWriter.scala index 8a52ac08..951aa253 100644 --- a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/io/UrlWriter.scala +++ b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/io/UrlWriter.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.io import com.github.fsanaulla.chronicler.core.enums.{Consistency, Precision} @@ -20,12 +36,12 @@ private[urlhttp] trait UrlWriter with PointTransformer with HasCredentials { self: WriteOperations[Try, String] => - override def writeTo(dbName: String, - entity: String, - consistency: Consistency, - precision: Precision, - retentionPolicy: Option[String], - gzipped: Boolean): Try[WriteResult] = { + private[chronicler] override def writeTo(dbName: String, + entity: String, + consistency: Consistency, + precision: Precision, + retentionPolicy: Option[String], + gzipped: Boolean): Try[WriteResult] = { val uri = writeToInfluxQuery(dbName, consistency, precision, retentionPolicy) val req = sttp .post(uri) @@ -36,12 +52,12 @@ private[urlhttp] trait UrlWriter execute(maybeEncoded).flatMap(toResult) } - override def writeFromFile(dbName: String, - filePath: String, - consistency: Consistency, - precision: Precision, - retentionPolicy: Option[String], - gzipped: Boolean): Try[WriteResult] = { + private[chronicler] override def writeFromFile(dbName: String, + filePath: String, + consistency: Consistency, + precision: Precision, + retentionPolicy: Option[String], + gzipped: Boolean): Try[WriteResult] = { val uri = writeToInfluxQuery(dbName, consistency, precision, retentionPolicy) val req = sttp .post(uri) diff --git a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/models/UrlDeserializers.scala b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/models/UrlDeserializers.scala index 3a4d1fb2..c68786fd 100644 --- a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/models/UrlDeserializers.scala +++ b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/models/UrlDeserializers.scala @@ -1,18 +1,34 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.models import com.github.fsanaulla.chronicler.core.model.{Point, Serializer} private[urlhttp] object UrlDeserializers { - implicit val point2str: Serializer[Point, String] = new Serializer[Point, String] { + private[urlhttp] implicit val point2str: Serializer[Point, String] = new Serializer[Point, String] { def serialize(obj: Point): String = obj.serialize } - implicit val points2str: Serializer[Seq[Point], String] = new Serializer[Seq[Point], String] { + private[urlhttp] implicit val points2str: Serializer[Seq[Point], String] = new Serializer[Seq[Point], String] { def serialize(obj: Seq[Point]): String = obj.map(_.serialize).mkString("\n") } - implicit val seqString2Influx: Serializer[Seq[String], String] = new Serializer[Seq[String], String] { + private[urlhttp] implicit val seqString2Influx: Serializer[Seq[String], String] = new Serializer[Seq[String], String] { def serialize(obj: Seq[String]): String = obj.mkString("\n") } } diff --git a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/utils/Aliases.scala b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/utils/Aliases.scala index 69a575cc..04b5175e 100644 --- a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/utils/Aliases.scala +++ b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/utils/Aliases.scala @@ -1,8 +1,24 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.utils import com.softwaremill.sttp.{Id, RequestT} import jawn.ast.JValue private[urlhttp] object Aliases { - type Request = RequestT[Id, JValue, Nothing] + private[urlhttp] type Request = RequestT[Id, JValue, Nothing] } diff --git a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/utils/ResponseFormats.scala b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/utils/ResponseFormats.scala index ac59f64f..644fb24f 100644 --- a/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/utils/ResponseFormats.scala +++ b/url-http/src/main/scala/com/github/fsanaulla/chronicler/urlhttp/utils/ResponseFormats.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.utils import com.softwaremill.sttp.{ResponseAs, asString} diff --git a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/Extensions.scala b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/Extensions.scala index eba21bdf..21fe756d 100644 --- a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/Extensions.scala +++ b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/Extensions.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp import com.softwaremill.sttp.Response diff --git a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/TestHelper.scala b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/TestHelper.scala index cf5a8fc6..155d3176 100644 --- a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/TestHelper.scala +++ b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/TestHelper.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp import java.net.URLEncoder diff --git a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlJsonHandlerSpec.scala b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlJsonHandlerSpec.scala index 36187aaa..5e50b0b5 100644 --- a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlJsonHandlerSpec.scala +++ b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlJsonHandlerSpec.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.handlers import com.github.fsanaulla.chronicler.testing.unit.FlatSpecWithMatchers diff --git a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlQueryHandlerSpec.scala b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlQueryHandlerSpec.scala index 980f01ec..1c297268 100644 --- a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlQueryHandlerSpec.scala +++ b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlQueryHandlerSpec.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.handlers import com.github.fsanaulla.chronicler.testing.unit.{EmptyCredentials, FlatSpecWithMatchers} diff --git a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlResponseHandlerSpec.scala b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlResponseHandlerSpec.scala index 9d6d9fc2..80acc0d6 100644 --- a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlResponseHandlerSpec.scala +++ b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/handlers/UrlResponseHandlerSpec.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.handlers import com.github.fsanaulla.chronicler.core.model.ContinuousQuery diff --git a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/ContinuousQuerysSpec.scala b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/ContinuousQuerysSpec.scala index fddd4cb4..429916a9 100644 --- a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/ContinuousQuerysSpec.scala +++ b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/ContinuousQuerysSpec.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.query import com.github.fsanaulla.chronicler.core.query.ContinuousQuerys diff --git a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/DataManagementQuerySpec.scala b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/DataManagementQuerySpec.scala index e8a92ab5..1c68dc0c 100644 --- a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/DataManagementQuerySpec.scala +++ b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/DataManagementQuerySpec.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.query import com.github.fsanaulla.chronicler.core.query.DataManagementQuery diff --git a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/DatabaseOperationQuerySpec.scala b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/DatabaseOperationQuerySpec.scala index 7badd485..dc7b816a 100644 --- a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/DatabaseOperationQuerySpec.scala +++ b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/DatabaseOperationQuerySpec.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.query import com.github.fsanaulla.chronicler.core.enums.{Consistencies, Epochs, Precisions} diff --git a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/QuerysManagementQuerySpec.scala b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/QuerysManagementQuerySpec.scala index 2c729a72..a38f5fad 100644 --- a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/QuerysManagementQuerySpec.scala +++ b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/QuerysManagementQuerySpec.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.query import com.github.fsanaulla.chronicler.core.query.QuerysManagementQuery diff --git a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/RetentionPolicyManagementQuerySpec.scala b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/RetentionPolicyManagementQuerySpec.scala index 96ae7b26..db389671 100644 --- a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/RetentionPolicyManagementQuerySpec.scala +++ b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/RetentionPolicyManagementQuerySpec.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.query import com.github.fsanaulla.chronicler.core.query.RetentionPolicyManagementQuery diff --git a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/ShardManagementQuerySpec.scala b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/ShardManagementQuerySpec.scala index 93ec9c20..faed507f 100644 --- a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/ShardManagementQuerySpec.scala +++ b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/ShardManagementQuerySpec.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.query import com.github.fsanaulla.chronicler.core.query.ShardManagementQuery diff --git a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/SubscriptionsManagementQuerySpec.scala b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/SubscriptionsManagementQuerySpec.scala index 2f6efb57..2e80fc2d 100644 --- a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/SubscriptionsManagementQuerySpec.scala +++ b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/SubscriptionsManagementQuerySpec.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.query import com.github.fsanaulla.chronicler.core.enums.Destinations diff --git a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/UserManagementQuerySpec.scala b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/UserManagementQuerySpec.scala index ffe345d6..e02ca5c8 100644 --- a/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/UserManagementQuerySpec.scala +++ b/url-http/src/test/scala/com/github/fsanaulla/chronicler/urlhttp/query/UserManagementQuerySpec.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2018 Faiaz Sanaulla + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.github.fsanaulla.chronicler.urlhttp.query import com.github.fsanaulla.chronicler.core.enums.Privileges diff --git a/version.sbt b/version.sbt index 0ed6346f..a5b39efd 100644 --- a/version.sbt +++ b/version.sbt @@ -1 +1 @@ -version in ThisBuild := "0.3.0" \ No newline at end of file +version in ThisBuild := "0.3.1" \ No newline at end of file