Package jenkins.scm.api
Class SCMSourceObserver.Wrapped<O extends SCMSourceObserver>
- java.lang.Object
-
- jenkins.scm.api.SCMSourceObserver
-
- jenkins.scm.api.SCMSourceObserver.Wrapped<O>
-
- Type Parameters:
O
- the class of wrapped observer.
- Direct Known Subclasses:
SCMSourceObserver.Filter
- Enclosing class:
- SCMSourceObserver
public abstract static class SCMSourceObserver.Wrapped<O extends SCMSourceObserver> extends SCMSourceObserver
Base class for an observer that wraps another observer.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jenkins.scm.api.SCMSourceObserver
SCMSourceObserver.Filter<O extends SCMSourceObserver>, SCMSourceObserver.ProjectObserver, SCMSourceObserver.Wrapped<O extends SCMSourceObserver>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(String key, Object value)
Adds extra metadata about the overall organization.SCMSourceOwner
getContext()
Indicates who is asking for sources.Set<String>
getIncludes()
Returns the subset of "project" names that this observer is interested in ornull
if interested in all "project" names.TaskListener
getListener()
Provides a way of reporting progress.boolean
isObserving()
Returns information about whether the observer wants more results.SCMSourceObserver.ProjectObserver
observe(String projectName)
Declare that a new "project" such as a source repository has been found.-
Methods inherited from class jenkins.scm.api.SCMSourceObserver
filter
-
-
-
-
Constructor Detail
-
Wrapped
protected Wrapped(O delegate)
Constructor.- Parameters:
delegate
- the observer to delegate to.
-
-
Method Detail
-
getContext
@NonNull public SCMSourceOwner getContext()
Indicates who is asking for sources.- Specified by:
getContext
in classSCMSourceObserver
- Returns:
- a contextual item, typically a
OrganizationFolder
-
getListener
@NonNull public TaskListener getListener()
Provides a way of reporting progress.- Specified by:
getListener
in classSCMSourceObserver
- Returns:
- a logger
-
getIncludes
@CheckForNull public Set<String> getIncludes()
Returns the subset of "project" names that this observer is interested in ornull
if interested in all "project" names.Implementations should not assume that the
SCMSourceObserver.getIncludes()
will be honoured. This method is designed to provide a hint toSCMNavigator
implementations.- Overrides:
getIncludes
in classSCMSourceObserver
- Returns:
- the subset of "project" names that this observer is interested in or
null
. - See Also:
for the definition of "project" names
-
observe
@NonNull public SCMSourceObserver.ProjectObserver observe(@NonNull String projectName) throws IllegalArgumentException, IOException, InterruptedException
Declare that a new "project" such as a source repository has been found.- Specified by:
observe
in classSCMSourceObserver
- Parameters:
projectName
- a name of the project, such as a repository name within an organization; may be used as anItem.getName()
- Returns:
- a secondary callback to customize the project, on which you must call
SCMSourceObserver.ProjectObserver.complete()
- Throws:
IllegalArgumentException
- if thisprojectName
has already been encounteredIOException
- if observing thisprojectName
could not be completed due to anIOException
.InterruptedException
- if observing thisprojectName
was interrupted.
-
addAttribute
public void addAttribute(@NonNull String key, @Nullable Object value) throws IllegalArgumentException, ClassCastException
Adds extra metadata about the overall organization. Currently no metadata keys are defined; placeholder for description, icon, URL, etc.- Specified by:
addAttribute
in classSCMSourceObserver
- Parameters:
key
- a predefined attribute namevalue
- some value, of a type defined by the attribute, perhaps null if allowed by the attribute documentation- Throws:
IllegalArgumentException
- if the attribute name is unrecognized, or this attribute was already addedClassCastException
- if the attribute value is inappropriate for its type
-
isObserving
public boolean isObserving()
Returns information about whether the observer wants more results.- Overrides:
isObserving
in classSCMSourceObserver
- Returns:
true
if the observer is still observing orfalse
to signal that it is ok to stop early.
-
-