Skip to content

chore(docs): fix javadoc and improve it #774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
package io.javaoperatorsdk.operator.api.reconciler;

import io.fabric8.kubernetes.api.model.HasMetadata;
import io.javaoperatorsdk.operator.processing.event.source.EventSource;
import io.javaoperatorsdk.operator.processing.event.source.ResourceCache;

/**
* Contextual information made available to prepare event sources.
*
* @param <P> the type associated with the primary resource that is handled by your reconciler
*/
public class EventSourceInitializationContext<P extends HasMetadata> {

private final ResourceCache<P> primaryCache;
Expand All @@ -11,6 +17,11 @@ public EventSourceInitializationContext(ResourceCache<P> primaryCache) {
this.primaryCache = primaryCache;
}

/**
* Retrieves the cache that an {@link EventSource} can query to retrieve primary resources
*
* @return the primary resource cache
*/
public ResourceCache<P> getPrimaryCache() {
return primaryCache;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public interface EventSourceInitializer<P extends HasMetadata> {
/**
* Prepares a list of {@link EventSource} implementations to be registered by the SDK.
*
* @param primaryCache a cache providing direct access to primary resources so that event sources
* can extract relevant information from primary resources as needed
* @param context a {@link EventSourceInitializationContext} providing access to information
* useful to event sources
*/
List<EventSource> prepareEventSources(EventSourceInitializationContext<P> context);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,30 @@
import io.javaoperatorsdk.operator.processing.LifecycleAware;
import io.javaoperatorsdk.operator.processing.event.EventHandler;

/**
* Creates an event source to trigger your reconciler whenever something happens to a secondary or
* external resource that would not normally trigger your reconciler (as the primary resources are
* not changed). To register EventSources with so that your reconciler is triggered, please make
* your reconciler implement
* {@link io.javaoperatorsdk.operator.api.reconciler.EventSourceInitializer}.
*/
public interface EventSource extends LifecycleAware {

/**
* An optional name for your EventSource. This is only required if you need to register multiple
* EventSources for the same resource type (e.g. {@code Deployment}).
*
* @return the name associated with this EventSource
*/
default String name() {
return getClass().getCanonicalName();
}

/**
* Sets the {@link EventHandler} that is linked to your reconciler when this EventSource is
* registered.
*
* @param handler the {@link EventHandler} associated with your reconciler
*/
void setEventHandler(EventHandler handler);
}