-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added wrapper to scala classes and configured a new ExecutionContext
- Loading branch information
Showing
11 changed files
with
100 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/scala/io/smartdatalake/conversions/ScalaJavaConverter.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package io.smartdatalake.conversions | ||
|
||
import java.util.concurrent.CompletableFuture | ||
import org.eclipse.lsp4j.jsonrpc.messages | ||
import scala.concurrent.Future | ||
import scala.jdk.FutureConverters.* | ||
import scala.jdk.CollectionConverters.* | ||
|
||
trait ScalaJavaConverter { | ||
|
||
extension [T] (f: Future[T]) def toJava: CompletableFuture[T] = f.asJava.toCompletableFuture | ||
|
||
extension [T] (l: List[T]) def toJava: java.util.List[T] = l.asJava | ||
|
||
extension [L, R] (either: Either[L, R]) def toJava: messages.Either[L, R] = either match | ||
case Left(leftValue) => messages.Either.forLeft(leftValue) | ||
case Right(rightValue) => messages.Either.forRight(rightValue) | ||
|
||
} | ||
|
||
object ScalaJavaConverterAPI extends ScalaJavaConverter |
13 changes: 7 additions & 6 deletions
13
src/main/scala/io/smartdatalake/languageserver/SmartDataLakeLanguageServer.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
src/main/scala/io/smartdatalake/logging/LoggerOutputStream.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 12 additions & 2 deletions
14
src/main/scala/io/smartdatalake/logging/LoggingManager.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
package io.smartdatalake.logging | ||
|
||
import ch.qos.logback.classic.Level | ||
import org.slf4j.LoggerFactory | ||
|
||
import java.io.PrintStream | ||
|
||
object LoggingManager { | ||
|
||
def redirectStandardOutputToLoggerOutput(): Unit = | ||
val loggerRedirectedOutput = LoggerFactory.getLogger("redirectedOutput") | ||
val redirectedPrintStream = new PrintStream(new LoggerOutputStream(loggerRedirectedOutput)) | ||
val redirectedPrintStream = createPrintStreamWithLoggerName("redirectedOutput") | ||
System.setOut(redirectedPrintStream) | ||
println("Using new default output stream") | ||
|
||
def createPrintStreamWithLoggerName(loggerName: String, level: Level = Level.INFO): PrintStream = | ||
val logger = LoggerFactory.getLogger(loggerName) | ||
val printMethod: String => Unit = level match | ||
case Level.TRACE => logger.trace | ||
case Level.DEBUG => logger.debug | ||
case Level.INFO => logger.info | ||
case Level.WARN => logger.warn | ||
case Level.ERROR => logger.error | ||
PrintStream(LoggerOutputStream(printMethod)) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters