Skip to content

Commit

Permalink
Remove deprecated code. (#115)
Browse files Browse the repository at this point in the history
This PR removes leftover/dead code related to RQL. This includes classes, config settings, etc.
The most visible change is that rql""" is now snapi""".
It also applies some renames to classes that were conflicting with other projects, e.g. Service becomes RawService.
ProgramSettings is now gone; this was a complicated mechanism used to pass settings. This is no longer needed since the "options" are now available in the ProgramEnvironment.
The JIRACrashReporter is also removed from this codebase.
  • Loading branch information
miguelbranco80 authored Aug 24, 2023
1 parent b976f37 commit 99d68f8
Show file tree
Hide file tree
Showing 136 changed files with 943 additions and 4,164 deletions.
4 changes: 2 additions & 2 deletions raw-auth-api/src/main/scala/raw/auth/AuthException.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

package raw.auth

import raw.api.ServiceException
import raw.api.RawServiceException

abstract class AuthException(message: String, cause: Throwable = null)
extends ServiceException(s"authentication error: $message", cause)
extends RawServiceException(s"authentication error: $message", cause)

// Status 400
class GenericAuthException(message: String, cause: Throwable = null) extends AuthException(message, cause)
Expand Down
4 changes: 2 additions & 2 deletions raw-auth-api/src/main/scala/raw/auth/AuthService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import java.time.Instant
import java.time.temporal.ChronoUnit
import com.fasterxml.jackson.annotation.JsonIgnore
import raw.Uid
import raw.api.{AuthenticatedUser, Service}
import raw.api.{AuthenticatedUser, RawService}

object AuthService {
val PERMISSION_MANAGEMENT = "management"
Expand All @@ -25,7 +25,7 @@ object AuthService {
val AllPermissions = Seq(PERMISSION_IMPERSONATE, PERMISSION_MANAGEMENT)
}

trait AuthService extends Service {
trait AuthService extends RawService {
def public: PublicAuthService

def mgmt: MgmtAuthService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import raw.api.AuthenticatedUser
import raw.config.RawSettings
import raw.creds._

class LocalCredentialsService(implicit settings: RawSettings) extends CredentialsService {
class LocalCredentialsService extends CredentialsService {

override protected def doRegisterS3Bucket(user: AuthenticatedUser, bucket: S3Bucket): Boolean = {
false
Expand Down
9 changes: 3 additions & 6 deletions raw-cli/src/main/scala/raw/cli/RawCli.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ import raw.compiler.{
ErrorMessage,
ErrorPosition,
ProgramDefinition,
ProgramEnvironment,
ProgramOutputWriter
}
import raw.config.RawSettings
import raw.utils.RawUtils
import raw.runtime.ProgramEnvironment
import raw.utils._

import java.io.{ByteArrayOutputStream, PrintWriter}
import java.util.UUID
import scala.util.control.NonFatal

class RawCli(writer: PrintWriter) extends StrictLogging {
Expand All @@ -64,7 +63,6 @@ class RawCli(writer: PrintWriter) extends StrictLogging {

def query(code: String, silent: Boolean = false): Unit = {
try {
val id = UUID.randomUUID().toString
var query: ProgramOutputWriter = null

val environment =
Expand All @@ -77,7 +75,6 @@ class RawCli(writer: PrintWriter) extends StrictLogging {
val compiler = compilerService.getCompiler(user, programDefinition.environment.language)
val programContext = compilerService.getProgramContext(
compiler,
id,
programDefinition.code,
programDefinition.parameters,
programDefinition.environment
Expand Down Expand Up @@ -194,7 +191,7 @@ object RawCli extends App {
}
}
} finally {
RawUtils.withSuppressNonFatalException(rawCli.stop())
withSuppressNonFatalException(rawCli.stop())
}
} catch {
case _: EndOfFileException => // Exit gracefully and quietly.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@

package raw.compiler.common

import com.typesafe.config.ConfigException
import org.bitbucket.inkytonik.kiama.rewriting.Rewriter._
import raw.compiler.{CompilerException, ProgramSettings}
import raw.compiler.CompilerException
import raw.compiler.base.source._
import raw.compiler.base._
import raw.compiler.common.source._
Expand Down Expand Up @@ -56,28 +55,10 @@ abstract class Compiler(implicit compilerContext: CompilerContext)
None
}

def getProgramSettings(
source: String,
environment: ProgramEnvironment
): ProgramSettings = {
getProgramSettings(environment.options)
}

def getProgramContext(
programSettings: ProgramSettings,
runtimeContext: RuntimeContext
): ProgramContext = {
new ProgramContext(programSettings, runtimeContext, compilerContext)
}

protected def getProgramSettings(options: Map[String, String]): ProgramSettings = {
try {
ProgramSettings.buildFromOptions(options, compilerContext.settings)
} catch {
case ex: ConfigException =>
logger.warn(s"Error parsing options: $options", ex)
throw new CompilerException("invalid options")
}
new ProgramContext(runtimeContext, compilerContext)
}

final def getProgramDescription(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@

package raw.compiler.common

import raw.api.{AuthenticatedUser, Service}
import raw.api.{AuthenticatedUser, RawService}
import raw.compiler.base.ProgramContext
import raw.compiler.jvm.{RawDelegatingURLClassLoader, RawMutableURLClassLoader}
import raw.compiler.scala2.{Scala2CompilerContext, Scala2JvmCompiler}
import raw.compiler.{ProgramEnvironment, ProgramSettings}
import raw.config.RawSettings
import raw.creds.CredentialsServiceProvider
import raw.inferrer.InferrerServiceProvider
Expand All @@ -27,7 +26,7 @@ import raw.utils.RawConcurrentHashMap

import scala.util.control.NonFatal

class CompilerService(implicit settings: RawSettings) extends Service {
class CompilerService(implicit settings: RawSettings) extends RawService {

private val credentials = CredentialsServiceProvider()
private val byteStreamCache = ByteStreamCache(settings)
Expand Down Expand Up @@ -68,33 +67,27 @@ class CompilerService(implicit settings: RawSettings) extends Service {

def getProgramContext(
compiler: Compiler,
id: String,
code: String,
maybeArguments: Option[Array[(String, ParamValue)]],
environment: ProgramEnvironment
): ProgramContext = {
val programSettings = compiler.getProgramSettings(code, environment)
val runtimeContext =
getRuntimeContext(compiler, id, maybeArguments, environment, NullExecutionLogger, programSettings)
compiler.getProgramContext(programSettings, runtimeContext)
val runtimeContext = getRuntimeContext(compiler, maybeArguments, environment, NullExecutionLogger)
compiler.getProgramContext(runtimeContext)
}

private def getRuntimeContext(
compiler: Compiler,
id: String,
maybeArguments: Option[Array[(String, ParamValue)]],
environment: ProgramEnvironment,
executionLogger: ExecutionLogger,
programSettings: ProgramSettings
executionLogger: ExecutionLogger
): RuntimeContext = {
val sourceContext = compiler.compilerContext.sourceContext
new RuntimeContext(
id,
sourceContext,
programSettings,
settings,
executionLogger,
maybeArguments,
environment.scopes
environment
)
}

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ package raw.compiler.common.source
import raw.compiler.base.CompilerProvider
import raw.compiler.base.source._
import raw.compiler.{base, common}
import raw.utils.StringEscape
import raw.utils._

trait SourcePrettyPrinter extends base.source.SourcePrettyPrinter with common.Keywords {

Expand Down Expand Up @@ -71,7 +71,7 @@ trait SourcePrettyPrinter extends base.source.SourcePrettyPrinter with common.Ke
case Eval(r) => r match {
case RawBridgeImpl(lang, p) =>
val code = CompilerProvider.prettyPrint(lang, p)
method("$eval", s""""$lang"""", s""""${StringEscape.descape(code)}"""")
method("$eval", s""""$lang"""", s""""${descape(code)}"""")
case RawBridgeRef(t, id) =>
// Used exclusively when creating a program signature while templating code.
method("$eval", t, id)
Expand Down
Loading

0 comments on commit 99d68f8

Please sign in to comment.