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, getID
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getTriggeredEvents, getTriggeredResources
getID, isOwner
createResource, createResource, createResource, createResource, optionalToList
debug, debug, error, error, getContext
debug, debug, error, error, fatal, fatal, warn, warn
exceptionThrown
public 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 ResourceBuilderModel
public List<? extends ResourceModel> announceResources()
announceResources
in interface ResourceBuilderModel
public 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 ResourceBuilderModel
list
- 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.