public static class ServiceHub.DefaultImpls
A service hub simply vends references to the other services a node has. Some of those services may be missing or mocked out. This class is useful to pass to chunks of pluggable code that might have need of many different kinds of functionality and you don't want to hard-code which types in the interface.
Any services exposed to flows (public view) need to implement SerializeAsToken or similar to avoid their internal state from being serialized in checkpoints.
Modifier and Type | Method and Description |
---|---|
static java.security.KeyPair |
getLegalIdentityKey(ServiceHub $this)
Helper property to shorten code for fetching the Node's KeyPair associated with the
public legalIdentity Party from the key management service.
Typical use is during signing in flows and for unit test signing.
|
static java.security.KeyPair |
getNotaryIdentityKey(ServiceHub $this)
Helper property to shorten code for fetching the Node's KeyPair associated with the
public notaryIdentity Party from the key management service. It is assumed that this is only
used in contexts where the Node knows it is hosting a Notary Service. Otherwise, it will throw
an IllegalArgumentException.
Typical use is during signing in flows and for unit test signing.
|
static TransactionState<?> |
loadState(ServiceHub $this,
StateRef stateRef)
Given a
class StateRef loads the referenced transaction and looks up the specified output interface ContractState . |
static <T extends ContractState> |
toStateAndRef(ServiceHub $this,
StateRef ref)
Given a
class StateRef loads the referenced transaction and returns a class StateAndRef |
public static TransactionState<?> loadState(ServiceHub $this, StateRef stateRef)
Given a class StateRef
loads the referenced transaction and looks up the specified output interface ContractState
.
class StateRef
points to a non-existent transaction.class StateRef
,
interface ContractState
public static <T extends ContractState> StateAndRef<T> toStateAndRef(ServiceHub $this, StateRef ref)
Given a class StateRef
loads the referenced transaction and returns a class StateAndRef
class StateRef
points to a non-existent transaction.class StateRef
,
class StateAndRef
public static java.security.KeyPair getLegalIdentityKey(ServiceHub $this)
Helper property to shorten code for fetching the Node's KeyPair associated with the public legalIdentity Party from the key management service. Typical use is during signing in flows and for unit test signing.
TODO: legalIdentity can now be composed of multiple keys, should we return a list of keyPairs here? Right now the logic assumes the legal identity has a composite key with only one node
public static java.security.KeyPair getNotaryIdentityKey(ServiceHub $this)
Helper property to shorten code for fetching the Node's KeyPair associated with the public notaryIdentity Party from the key management service. It is assumed that this is only used in contexts where the Node knows it is hosting a Notary Service. Otherwise, it will throw an IllegalArgumentException. Typical use is during signing in flows and for unit test signing.