Interface WotThingDescriptionProvider
- All Superinterfaces:
akka.actor.Extension
@Immutable
public interface WotThingDescriptionProvider
extends akka.actor.Extension
Extension for providing WoT (Web of Things)
ThingDescriptions for given thingIds from either a
ThingDefinition or a FeatureDefinition from which the URL to a WoT
ThingModel is resolved and the ThingDescription is provided.- Since:
- 2.4.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic WotThingDescriptionProviderget(akka.actor.ActorSystem system) Get theWotThingDescriptionProviderfor an actor system.Optional<org.eclipse.ditto.things.model.Feature>provideFeatureSkeletonForCreation(String featureId, org.eclipse.ditto.things.model.FeatureDefinition featureDefinition, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders) Provides aFeatureskeleton for the givenfeatureIdusing the passedfeatureDefinitionto extract a ThingModel URL from, fetching the ThingModel and generating the skeleton viaWotThingSkeletonGenerator.org.eclipse.ditto.wot.model.ThingDescriptionprovideFeatureTD(org.eclipse.ditto.things.model.ThingId thingId, org.eclipse.ditto.things.model.Thing thing, org.eclipse.ditto.things.model.Feature feature, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders) Provides aThingDescriptionfor the giventhingDefinition,thingIdandfeatureIdcombination.Optional<org.eclipse.ditto.things.model.Thing>provideThingSkeletonForCreation(org.eclipse.ditto.things.model.ThingId thingId, org.eclipse.ditto.things.model.ThingDefinition thingDefinition, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders) Provides aThingskeleton for the giventhingIdusing the passedthingDefinitionto extract a ThingModel URL from, fetching the ThingModel and generating the skeleton viaWotThingSkeletonGenerator.org.eclipse.ditto.wot.model.ThingDescriptionprovideThingTD(org.eclipse.ditto.things.model.ThingDefinition thingDefinition, org.eclipse.ditto.things.model.ThingId thingId, org.eclipse.ditto.things.model.Thing thing, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders) Provides aThingDescriptionfor the giventhingDefinitionandthingIdcombination.
-
Method Details
-
provideThingTD
org.eclipse.ditto.wot.model.ThingDescription provideThingTD(@Nullable org.eclipse.ditto.things.model.ThingDefinition thingDefinition, org.eclipse.ditto.things.model.ThingId thingId, @Nullable org.eclipse.ditto.things.model.Thing thing, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders) Provides aThingDescriptionfor the giventhingDefinitionandthingIdcombination.- Parameters:
thingDefinition- the ThingDefinition to extract the URL from aThingModelfrom to use as template for the providedThingDescription.thingId- the ThingId to provide the ThingDescription for.thing- the optional Thing to use to resolve placeholders and metadata from.dittoHeaders- the DittoHeaders for possibly thrown DittoRuntimeExceptions.- Returns:
- the ThingDescription.
- Throws:
org.eclipse.ditto.wot.model.ThingDefinitionInvalidException- if the passed inthingDefinitionwasnullor did not contain a ThingModel URL.org.eclipse.ditto.wot.model.WotThingModelNotAccessibleException- if the ThingModel could not be accessed/ downloaded.
-
provideFeatureTD
org.eclipse.ditto.wot.model.ThingDescription provideFeatureTD(org.eclipse.ditto.things.model.ThingId thingId, @Nullable org.eclipse.ditto.things.model.Thing thing, org.eclipse.ditto.things.model.Feature feature, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders) Provides aThingDescriptionfor the giventhingDefinition,thingIdandfeatureIdcombination.- Parameters:
thingId- the ThingId to provide the ThingDescription for.thing- the optional Thing to use to resolve placeholders and metadata from.feature- the Feature to provide the ThingDescription for.dittoHeaders- the DittoHeaders for possibly thrown DittoRuntimeExceptions.- Returns:
- the ThingDescription.
- Throws:
org.eclipse.ditto.wot.model.ThingDefinitionInvalidException- if the passed infeatureDefinitionwasnullor did not contain a ThingModel URL.org.eclipse.ditto.wot.model.WotThingModelNotAccessibleException- if the ThingModel could not be accessed/ downloaded.
-
provideThingSkeletonForCreation
Optional<org.eclipse.ditto.things.model.Thing> provideThingSkeletonForCreation(org.eclipse.ditto.things.model.ThingId thingId, @Nullable org.eclipse.ditto.things.model.ThingDefinition thingDefinition, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders) Provides aThingskeleton for the giventhingIdusing the passedthingDefinitionto extract a ThingModel URL from, fetching the ThingModel and generating the skeleton viaWotThingSkeletonGenerator. The implementation should not throw exceptions, but return an empty optional if something went wrong during fetching or generation of the skeleton.- Parameters:
thingId- the ThingId to generate the Thing skeleton for.thingDefinition- the ThingDefinition to resolve the ThingModel URL from.dittoHeaders- the DittoHeaders for possibly thrown DittoRuntimeExceptions.- Returns:
- an optional Thing skeleton or empty optional if something went wrong during the skeleton creation.
-
provideFeatureSkeletonForCreation
Optional<org.eclipse.ditto.things.model.Feature> provideFeatureSkeletonForCreation(String featureId, @Nullable org.eclipse.ditto.things.model.FeatureDefinition featureDefinition, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders) Provides aFeatureskeleton for the givenfeatureIdusing the passedfeatureDefinitionto extract a ThingModel URL from, fetching the ThingModel and generating the skeleton viaWotThingSkeletonGenerator. The implementation should not throw exceptions, but return an empty optional if something went wrong during fetching or generation of the skeleton.- Parameters:
featureId- the FeatureId to generate the Feature skeleton for.featureDefinition- the FeatureDefinition to resolve the ThingModel URL from.dittoHeaders- the DittoHeaders for possibly thrown DittoRuntimeExceptions.- Returns:
- an optional Feature skeleton or empty optional if something went wrong during the skeleton creation.
-
get
Get theWotThingDescriptionProviderfor an actor system.- Parameters:
system- the actor system.- Returns:
- the
WotThingDescriptionProviderextension.
-