blob: 50d629ce34a2ed92492a3b55de454d7c81bdabb6 (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.jdisc;
import com.google.inject.AbstractModule;
import com.google.inject.name.Names;
import com.yahoo.jdisc.test.TestDriver;
import org.apache.commons.daemon.Daemon;
import org.apache.commons.daemon.DaemonContext;
/**
* @author Einar M R Rosenvinge
*/
public class Main implements Daemon {
public static void main(String[] args) {
startContainer(System.getProperty("config.id"));
}
public static TestDriver startContainer(final String configId) {
System.setProperty("config.id", configId);
@SuppressWarnings("unused")
TestDriver driver = TestDriver.newInjectedApplicationInstance(ConfiguredApplication.class,
new AbstractModule() {
@Override
protected void configure() {
bind(String.class).annotatedWith(Names.named("configId")).toInstance(configId);
}
});
return driver;
}
@Override
public void init(DaemonContext context) throws Exception {
//nada
}
@Override
public void start() throws Exception {
main(new String[0]);
}
@Override
public void stop() throws Exception {
//TODO: Implement this method:
}
@Override
public void destroy() {
//nada
}
}
|