mirror of https://github.com/zlatinb/muwire
first pass at main point
parent
07b8724e8f
commit
5a2019f8eb
|
@ -1,9 +1,44 @@
|
||||||
package com.muwire.core
|
package com.muwire.core
|
||||||
|
|
||||||
|
import com.muwire.core.trust.TrustEvent
|
||||||
|
import com.muwire.core.trust.TrustService
|
||||||
|
|
||||||
|
import groovy.util.logging.Log
|
||||||
|
|
||||||
|
@Log
|
||||||
class Core {
|
class Core {
|
||||||
|
|
||||||
static main(args) {
|
static main(args) {
|
||||||
println "This doesn't do anything yet"
|
def home = System.getProperty("user.home") + File.separator + ".MuWire"
|
||||||
|
home = new File(home)
|
||||||
|
if (!home.exists()) {
|
||||||
|
log.info("creating home dir")
|
||||||
|
home.mkdir()
|
||||||
|
}
|
||||||
|
|
||||||
|
def props = new Properties()
|
||||||
|
def propsFile = new File(home, "MuWire.properties")
|
||||||
|
if (propsFile.exists()) {
|
||||||
|
log.info("loading existing props file")
|
||||||
|
propsFile.withInputStream {
|
||||||
|
props.load(it)
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
log.info("creating default properties")
|
||||||
|
|
||||||
|
props = new MuWireSettings(props)
|
||||||
|
|
||||||
|
|
||||||
|
EventBus eventBus = new EventBus()
|
||||||
|
|
||||||
|
log.info("initializing trust service")
|
||||||
|
File goodTrust = new File(home, "trust.good")
|
||||||
|
File badTrust = new File(home, "trust.bad")
|
||||||
|
TrustService trustService = new TrustService(goodTrust, badTrust, 5000)
|
||||||
|
eventBus.register(TrustEvent.class, trustService)
|
||||||
|
trustService.start()
|
||||||
|
trustService.waitForLoad()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue