<commit_before>package blended.security.scep.standalone

import java.io.File
import java.util.ServiceLoader

import scala.collection.JavaConverters._
import scala.concurrent.Future
import scala.concurrent.Promise

import blended.container.context.api.ContainerIdentifierService
import blended.container.context.impl.internal.ContainerIdentifierServiceImpl
import blended.security.ssl.CertificateManager
import blended.security.ssl.internal.ServerKeyStore
import blended.util.logging.Logger
import domino.DominoActivator
import org.apache.felix.connect.launch.ClasspathScanner
import org.apache.felix.connect.launch.PojoServiceRegistryFactory

class CertRefresher(salt: String) {

  private[this] val log = Logger[CertRefresher]

  implicit val executionContext = scala.concurrent.ExecutionContext.global

  val baseDir = {
    val baseDir = new File(".").getAbsolutePath()
    System.setProperty("blended.container.home", baseDir)
    System.setProperty("scepclient.home", baseDir)
    baseDir
  }

  val registry = {
    // Start Felix Connect Runtime

    val symbolicNames = List(
      "blended.security.ssl",
      "blended.security.scep"
    )
    val bundleFilter = s"(|${symbolicNames.map(n => s"(Bundle-SymbolicName=${n}*)").mkString("")})"
    val bundles = new ClasspathScanner().scanForBundles(bundleFilter)
    log.debug(s"Found bundles: ${bundles.asScala.map(b => s"${b.getHeaders().get("Bundle-SymbolicName")} -> ${b}").mkString("\n")}")

    val config = Map[String, Object](
      PojoServiceRegistryFactory.BUNDLE_DESCRIPTORS -> bundles
    )

    val loader = ServiceLoader.load(classOf[PojoServiceRegistryFactory])
    val factory = loader.iterator().next()
    log.debug(s"Found factory: ${factory}")

    val registry = factory.newPojoServiceRegistry(config.asJava)<commit_msg>Use lazy val to avoid unnecessary early start<commit_after>package blended.security.scep.standalone

import java.io.File
import java.util.ServiceLoader

import scala.collection.JavaConverters._
import scala.concurrent.Future
import scala.concurrent.Promise

import blended.container.context.api.ContainerIdentifierService
import blended.container.context.impl.internal.ContainerIdentifierServiceImpl
import blended.security.ssl.CertificateManager
import blended.security.ssl.internal.ServerKeyStore
import blended.util.logging.Logger
import domino.DominoActivator
import org.apache.felix.connect.launch.ClasspathScanner
import org.apache.felix.connect.launch.PojoServiceRegistryFactory

class CertRefresher(salt: String) {

  private[this] val log = Logger[CertRefresher]

  implicit val executionContext = scala.concurrent.ExecutionContext.global

  val baseDir = {
    val baseDir = new File(".").getAbsolutePath()
    System.setProperty("blended.container.home", baseDir)
    System.setProperty("scepclient.home", baseDir)
    baseDir
  }

  lazy val registry = {
    // Start Felix Connect Runtime

    val symbolicNames = List(
      "blended.security.ssl",
      "blended.security.scep"
    )
    val bundleFilter = s"(|${symbolicNames.map(n => s"(Bundle-SymbolicName=${n}*)").mkString("")})"
    val bundles = new ClasspathScanner().scanForBundles(bundleFilter)
    log.debug(s"Found bundles: ${bundles.asScala.map(b => s"${b.getHeaders().get("Bundle-SymbolicName")} -> ${b}").mkString("\n")}")

    val config = Map[String, Object](
      PojoServiceRegistryFactory.BUNDLE_DESCRIPTORS -> bundles
    )

    val loader = ServiceLoader.load(classOf[PojoServiceRegistryFactory])
    val factory = loader.iterator().next()
    log.debug(s"Found factory: ${factory}")

    val registry = factory.newPojoServiceRegistry(config.asJava)
{'fraction_non_alphanumeric': 0.11774415405777167, 'fraction_numerical': 0.0, 'mean_word_length': 4.990115321252059, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '988589', 'n_tokens_mistral': 1093, 'n_tokens_neox': 1062, 'n_words': 191}