CORDA-2361: Split samples into contracts and workflows (#4575)

This commit is contained in:
Katarzyna Streich
2019-01-23 13:26:33 +00:00
committed by GitHub
parent 82f5a756fe
commit 35acbc8107
73 changed files with 562 additions and 383 deletions

View File

@ -0,0 +1,19 @@
apply plugin: 'kotlin'
apply plugin: 'idea'
apply plugin: 'net.corda.plugins.cordapp'
apply plugin: 'net.corda.plugins.cordformation'
dependencies {
cordaCompile project(':core')
}
cordapp {
targetPlatformVersion corda_platform_version.toInteger()
minimumPlatformVersion 1
workflow {
name "Cordapp Configuration Sample"
versionId 1
vendor "R3"
licence "Open Source (Apache 2)"
}
}

View File

@ -0,0 +1,5 @@
someStringValue=hello world
someIntValue=1
nested: {
value: a string
}

View File

@ -0,0 +1,25 @@
package net.corda.configsample
import co.paralleluniverse.fibers.Suspendable
import net.corda.core.contracts.CommandData
import net.corda.core.contracts.Contract
import net.corda.core.contracts.ContractState
import net.corda.core.flows.FlowLogic
import net.corda.core.flows.StartableByRPC
import net.corda.core.identity.AbstractParty
import net.corda.core.serialization.CordaSerializable
import net.corda.core.transactions.LedgerTransaction
import net.corda.core.utilities.ProgressTracker
@StartableByRPC
class GetStringConfigFlow(private val configKey: String) : FlowLogic<String>() {
object READING : ProgressTracker.Step("Reading config")
override val progressTracker = ProgressTracker(READING)
@Suspendable
override fun call(): String {
progressTracker.currentStep = READING
val config = serviceHub.getAppContext().config
return config.getString(configKey)
}
}

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
</Console>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Console" />
</Root>
</Loggers>
</Configuration>