Address PR 379 comments

This commit is contained in:
Andras Slemmer
2017-03-17 12:27:25 +00:00
parent c3c1f3d801
commit d3f956ab60
21 changed files with 57 additions and 49 deletions

View File

@ -1,17 +1,19 @@
package net.corda.node
package net.corda.nodeapi
import com.google.common.net.HostAndPort
import net.corda.config.SSLConfiguration
import net.corda.nodeapi.config.SSLConfiguration
import org.apache.activemq.artemis.api.core.TransportConfiguration
import org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory
import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory
import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants
import java.nio.file.FileSystems
import java.nio.file.Path
sealed class ConnectionDirection {
object Inbound : ConnectionDirection()
class Outbound(val expectedCommonName: String? = null) : ConnectionDirection()
class Inbound(val acceptorFactoryClassName: String) : ConnectionDirection()
class Outbound(
val expectedCommonName: String? = null,
val connectorFactoryClassName: String = NettyConnectorFactory::class.java.name
) : ConnectionDirection()
}
class ArtemisTcpTransport {
@ -35,8 +37,6 @@ class ArtemisTcpTransport {
direction: ConnectionDirection,
hostAndPort: HostAndPort,
config: SSLConfiguration?,
acceptorFactoryClassName: String = NettyAcceptorFactory::class.java.name,
connectorFactoryClassName: String = NettyConnectorFactory::class.java.name,
enableSSL: Boolean = true
): TransportConfiguration {
val options = mutableMapOf<String, Any?>(
@ -72,8 +72,8 @@ class ArtemisTcpTransport {
options.putAll(tlsOptions)
}
val factoryName = when (direction) {
is ConnectionDirection.Inbound -> acceptorFactoryClassName
is ConnectionDirection.Outbound -> connectorFactoryClassName
is ConnectionDirection.Inbound -> direction.acceptorFactoryClassName
is ConnectionDirection.Outbound -> direction.connectorFactoryClassName
}
return TransportConfiguration(factoryName, options)
}

View File

@ -1,9 +1,8 @@
package net.corda.config
package net.corda.nodeapi.config
import com.google.common.net.HostAndPort
import com.typesafe.config.Config
import java.net.URL
import java.nio.file.FileSystems
import java.nio.file.Path
import java.nio.file.Paths
import java.time.Instant

View File

@ -1,4 +1,4 @@
package net.corda.config
package net.corda.nodeapi.config
import net.corda.core.div
import java.nio.file.Path