public abstract class ContentGenerator extends AddOnModule implements ContentGeneratorModel, ResourceCreator
When an Event this ContentGenerator subscribed to was fired, the ContentGeneratorManager will run the instance of it in a ThreadPool and generate(String eventID) will be called.
| Constructor and Description |
|---|
ContentGenerator(String id,
Context context)
Creates a new content generator.
|
| Modifier and Type | Method and Description |
|---|---|
List<? extends EventModel<?>> |
announceEvents()
this method is called to register for what Events it wants to provide Resources.
|
List<? extends ResourceModel> |
announceResources()
This method is called to register what resources the object provides.
|
List<ResourceModel> |
provideResource(List<? extends ResourceModel> list,
Optional<EventModel> optional)
this method is called when an object wants to get a Resource.
|
abstract List<? extends Resource> |
triggered(List<? extends ResourceModel> list,
Optional<EventModel> optional)
this method is called when an object wants to get a Resource.
|
getContext, getIDclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetTriggeredEvents, getTriggeredResourcesgetID, isOwnercreateResource, createResource, createResource, createResource, optionalToListdebug, debug, error, error, getContextdebug, debug, error, error, fatal, fatal, warn, warnexceptionThrownpublic ContentGenerator(String id, Context context)
id - the id of the content generatorcontext - the context of the addOnpublic List<? extends EventModel<?>> announceEvents()
The Event has to be in the following format: It should contain only one Descriptor and and one Resource with the ID "description", which contains an description of the Event.
announceEvents in interface ResourceBuilderModelpublic List<? extends ResourceModel> announceResources()
announceResources in interface ResourceBuilderModelpublic List<ResourceModel> provideResource(List<? extends ResourceModel> list, Optional<EventModel> optional)
Don't use the Resources provided as arguments, they are just the requests. There is a timeout after 1 second.
provideResource in interface ResourceBuilderModellist - a list of resources without dataoptional - if an event caused the action, it gets passed. It can also be null.public abstract List<? extends Resource> triggered(List<? extends ResourceModel> list, Optional<EventModel> optional)
Don't use the Resources provided as arguments, they are just the requests. There is a timeout after 1 second.
list - a list of resources without dataoptional - if an event caused the action, it gets passed. It can also be null.Copyright © 2016. All rights reserved.