summaryrefslogtreecommitdiffstats
path: root/standalone-container/src/main/scala/com/yahoo/application/container/impl/StandaloneContainerRunner.scala
blob: 57f60febb264432e5a951ecda48256c28db401bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.application.container.impl

import java.nio.file.Files
import com.yahoo.text.Utf8

/**
 * @author tonytv
 */
final class StandaloneContainerRunner {



}

object StandaloneContainerRunner {
  def createApplicationPackage(servicesXml: String) = {
    val applicationDir = Files.createTempDirectory("application")

    val servicesXmlFile = applicationDir.resolve("services.xml");
    var content = servicesXml;
    if ( ! servicesXml.startsWith("<?xml"))
        content = """<?xml version="1.0" encoding="utf-8" ?>""" + '\n' + servicesXml
    Files.write(servicesXmlFile, Utf8.toBytes(content))
    applicationDir
  }
}