public class DefaultNetworkContext extends BaseContext<NetworkContext> implements NetworkContext
| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultNetworkContext.Builder
Network context builder.
|
address, observers| Modifier and Type | Method and Description |
|---|---|
String |
address()
Returns the context address.
|
<T extends ComponentContext<T>> |
component(String name)
Returns a component context by name.
|
List<ComponentContext<?>> |
components()
Returns a list of network component contexts.
|
NetworkConfig |
config()
Returns the network configuration from which the context was built.
|
static DefaultNetworkContext |
fromJson(org.vertx.java.core.json.JsonObject context)
Creates a network context from JSON.
|
boolean |
hasComponent(String name)
Returns a boolean indicating whether the component exists.
|
String |
name()
Returns the network name.
|
void |
notify(NetworkContext update)
Notifies all observers of an update.
|
String |
status()
Returns the network status address.
|
static org.vertx.java.core.json.JsonObject |
toJson(NetworkContext context)
Serializes a network context to JSON.
|
String |
toString() |
String |
version()
Returns the network version.
|
copy, equals, hashCode, registerObserver, unregisterObserverclone, finalize, getClass, notify, notifyAll, wait, wait, waitregisterObserver, unregisterObserverpublic static DefaultNetworkContext fromJson(org.vertx.java.core.json.JsonObject context)
context - A JSON representation of the network context.MalformedContextException - If the network context is malformed.public static org.vertx.java.core.json.JsonObject toJson(NetworkContext context)
context - The network context to serialize.public String name()
NetworkContextThe network name is unique to the network within a Vertigo cluster.
name in interface NetworkContextpublic String version()
NetworkContextversion in interface NetworkContextpublic NetworkConfig config()
NetworkContextconfig in interface NetworkContextpublic String address()
Contextaddress in interface Context<NetworkContext>public String status()
NetworkContextThis is the address of a shared-data key that is monitored by all component instances in the cluster. When the key is set, components know that the network is considered stable. During a network configuration change, the network manager will unset the status address, notifying components that the network is no longer stable until the key is reset. This is the mechanism used by Vertigo to perform coordination between components.
status in interface NetworkContextpublic List<ComponentContext<?>> components()
NetworkContextcomponents in interface NetworkContextpublic boolean hasComponent(String name)
hasComponent in interface NetworkContextname - The name of the component to check.public <T extends ComponentContext<T>> T component(String name)
NetworkContextcomponent in interface NetworkContextname - The component name.public void notify(NetworkContext update)
Observablenotify in interface Observable<NetworkContext>notify in class BaseContext<NetworkContext>update - The updated object.public String toString()
toString in class BaseContext<NetworkContext>Copyright © 2013-2014. All Rights Reserved.