first pass at main point

pull/4/head
Zlatin Balevsky 2018-07-23 16:09:59 +01:00
parent 07b8724e8f
commit 5a2019f8eb
1 changed files with 36 additions and 1 deletions

View File

@ -1,9 +1,44 @@
package com.muwire.core
import com.muwire.core.trust.TrustEvent
import com.muwire.core.trust.TrustService
import groovy.util.logging.Log
@Log
class Core {
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()
}
}