public final class Chassis extends Object
If you need a more complex environment or tests case you can create one or more AssetTrees directly.
Modifier and Type | Method and Description |
---|---|
static Asset |
acquireAsset(@NotNull String name)
Get or create an empty asset
|
static <K,V> @NotNull MapView<K,V> |
acquireMap(@NotNull String uri,
Class<K> kClass,
Class<V> vClass)
Get or create a Map, ConcurrentMap or MapView of an asset.
|
static <E> @NotNull Publisher<E> |
acquirePublisher(@NotNull String uri,
Class<E> eClass)
Get or create a Publisher view for a given element or update type.
|
static <T,M> @NotNull QueueView<T,M> |
acquireQueue(@NotNull String uri,
Class<T> typeClass,
Class<M> messageClass) |
static <E> @NotNull Reference<E> |
acquireReference(@NotNull String uri,
Class<E> eClass)
Obtain a reference to an element or value of Map.
|
static <E> @NotNull Set<E> |
acquireSet(@NotNull String uri,
Class<E> eClass)
View an asset as a set.
|
static <T,M> @NotNull TopicPublisher<T,M> |
acquireTopicPublisher(@NotNull String uri,
Class<T> tClass,
Class<M> mClass)
Get or create a TopicPublisher.
|
static AssetTree |
assetTree() |
static void |
close()
Shutdown everything in the asset tree.
|
static @NotNull Optional<Asset> |
getAsset(String uri)
Get an existing Asset or return null
|
static <E> void |
registerSubscriber(@NotNull String uri,
Class<E> eClass,
@NotNull Subscriber<? extends E> subscriber)
Register a Subscriber to events on an Asset.
|
static <T,M> void |
registerTopicSubscriber(@NotNull String uri,
Class<T> tClass,
Class<M> mClass,
@NotNull TopicSubscriber<? extends T,? extends M> subscriber)
Register a Topic Subscription to a group.
|
static void |
resetChassis()
Replace the underlying
|
static <E> void |
unregisterSubscriber(@NotNull String uri,
@NotNull Subscriber<E> subscriber)
Unregister a subscriber.
|
static <T,M> void |
unregisterTopicSubscriber(@NotNull String uri,
@NotNull TopicSubscriber<T,M> subscriber)
Unregister a TopicSubscriber.
|
public static void resetChassis()
public static AssetTree assetTree()
@NotNull public static <E> @NotNull Set<E> acquireSet(@NotNull @NotNull String uri, Class<E> eClass)
E
- element typeuri
- of the seteClass
- of the elements of the setAssetNotFoundException
- if not found or could not be created.@NotNull public static <K,V> @NotNull MapView<K,V> acquireMap(@NotNull @NotNull String uri, Class<K> kClass, Class<V> vClass)
K
- key typeV
- value typeuri
- of the Map.kClass
- key classvClass
- value classAssetNotFoundException
- if not found or could not be created.@NotNull public static <E> @NotNull Reference<E> acquireReference(@NotNull @NotNull String uri, Class<E> eClass)
E
- element typeuri
- of the resourceeClass
- the type of the elementAssetNotFoundException
- if not found or could not be created.@NotNull public static <E> @NotNull Publisher<E> acquirePublisher(@NotNull @NotNull String uri, Class<E> eClass)
E
- element typeuri
- to publish to.eClass
- of the data to publishAssetNotFoundException
- if not found or could not be created.@NotNull public static <T,M> @NotNull QueueView<T,M> acquireQueue(@NotNull @NotNull String uri, Class<T> typeClass, Class<M> messageClass)
@NotNull public static <T,M> @NotNull TopicPublisher<T,M> acquireTopicPublisher(@NotNull @NotNull String uri, Class<T> tClass, Class<M> mClass)
T
- topic typeM
- message typeuri
- of the group to publish to. When you specify a topic, in will be immediately
under that group.tClass
- class of the topic. Typically String.classmClass
- class of the messages to publish on that topic.AssetNotFoundException
- if not found or could not be created.public static <E> void registerSubscriber(@NotNull @NotNull String uri, Class<E> eClass, @NotNull @NotNull Subscriber<? extends E> subscriber)
E
- element typeuri
- of the asset to subscribe to event for.eClass
- of the subscriptionsubscriber
- to listen to events.AssetNotFoundException
- if not found or could not be created.public static <E> void unregisterSubscriber(@NotNull @NotNull String uri, @NotNull @NotNull Subscriber<E> subscriber)
E
- element typeuri
- of the asset to unsubscribe from.subscriber
- to unregisterpublic static <T,M> void registerTopicSubscriber(@NotNull @NotNull String uri, Class<T> tClass, Class<M> mClass, @NotNull @NotNull TopicSubscriber<? extends T,? extends M> subscriber)
T
- topic typeM
- message typeuri
- of the group of Assets to listen to.tClass
- topic classmClass
- element class for messages.subscriber
- to listen to events onAssetNotFoundException
- if not found or could not be created.public static <T,M> void unregisterTopicSubscriber(@NotNull @NotNull String uri, @NotNull @NotNull TopicSubscriber<T,M> subscriber)
T
- topic typeM
- message typeuri
- of the group of Assets to unregister fromsubscriber
- to remove.public static Asset acquireAsset(@NotNull @NotNull String name)
name
- of the assetAssetNotFoundException
- if not found or could not be created.@NotNull public static @NotNull Optional<Asset> getAsset(String uri)
uri
- of the assetpublic static void close()
Copyright © 2021. All rights reserved.