T
- the type of source from which this StreamOrientedChartLoader
is capable of loading Helm chartspublic abstract class StreamOrientedChartLoader<T> extends AbstractChartLoader<T>
AbstractChartLoader
implementation that is capable of
loading a Helm-compatible chart from any source that is convertible into an
Iterable
of InputStream
s indexed by their
name.toNamedInputStreamEntries(Object)
Modifier | Constructor and Description |
---|---|
protected |
StreamOrientedChartLoader()
Creates a new
StreamOrientedChartLoader . |
Modifier and Type | Method and Description |
---|---|
protected TemplateOuterClass.Template.Builder |
createTemplateBuilder(ChartOuterClass.Chart.Builder chartBuilder,
InputStream stream,
String name)
|
protected void |
installAny(ChartOuterClass.Chart.Builder chartBuilder,
InputStream stream,
String name)
Installs an
Any object, representing an arbitrary chart
file with the supplied name and represented by the
supplied InputStream , into the supplied Chart.Builder . |
protected void |
installConfig(ChartOuterClass.Chart.Builder chartBuilder,
InputStream stream)
Installs a
ConfigOuterClass.Config object, represented by the supplied
InputStream , into the supplied Chart.Builder . |
protected void |
installMetadata(ChartOuterClass.Chart.Builder chartBuilder,
InputStream stream)
Installs a
MetadataOuterClass.Metadata object, represented by the supplied
InputStream , into the supplied Chart.Builder . |
ChartOuterClass.Chart.Builder |
load(ChartOuterClass.Chart.Builder parent,
Iterable<? extends Map.Entry<? extends String,? extends InputStream>> entrySet)
Creates a new
ChartOuterClass.Chart from the supplied notional set of
named InputStream s and returns it. |
ChartOuterClass.Chart.Builder |
load(ChartOuterClass.Chart.Builder parent,
T source)
Creates a new
ChartOuterClass.Chart from the supplied source in
some manner and returns it. |
protected abstract Iterable<? extends Map.Entry<? extends String,? extends InputStream>> |
toNamedInputStreamEntries(T source)
Converts the supplied
source into an Iterable of
Map.Entry instances whose keys
are names and whose values are
corresponding InputStream s. |
load
protected StreamOrientedChartLoader()
StreamOrientedChartLoader
.protected abstract Iterable<? extends Map.Entry<? extends String,? extends InputStream>> toNamedInputStreamEntries(T source) throws IOException
source
into an Iterable
of
Map.Entry
instances whose keys
are names and whose values are
corresponding InputStream
s.
Implementations of this method must not return null
.
The Iterable
of Map.Entry
instances returned by
implementations of this method must produce an Iterator
that will
never return null
from any invocation of its Iterator.next()
method when, on the same thread, the return
value of an invocation of its Iterator.hasNext()
method
has previously returned true
.
Map.Entry
instances returned by Iterator
instances
produced by the Iterable
returned by this method must never return null
from their
Map.Entry.getKey()
method. They are permitted to return
null
from their Map.Entry.getValue()
method, and this
feature can be used, for example, to indicate that a particular
entry is a directory.
source
- the source to convert; must not be null
Iterable
of suitable Map.Entry
instances;
never null
NullPointerException
- if source
is null
IOException
- if an error occurs while convertingpublic ChartOuterClass.Chart.Builder load(ChartOuterClass.Chart.Builder parent, T source) throws IOException
ChartOuterClass.Chart
from the supplied source
in
some manner and returns it.
This method never returns null
.
This method calls the load(hapi.chart.ChartOuterClass.Chart.Builder, Iterable)
method
with the return value of the toNamedInputStreamEntries(Object)
method.
load
in class AbstractChartLoader<T>
source
- the source object from which to load a new ChartOuterClass.Chart
; must not be null
parent
- the ChartOuterClass.Chart.Builder
that will serve as the parent
of the ChartOuterClass.Chart.Builder
that will be returned; may be (and often
is) null
, indicating that the ChartOuterClass.Chart.Builder
being
returned does not represent a subchart; must not be what is
returnedChartOuterClass.Chart
; never null
NullPointerException
- if source
is null
IllegalStateException
- if the load(hapi.chart.ChartOuterClass.Chart.Builder, Iterable)
method
returns null
IOException
- if a problem is encountered while creating
the ChartOuterClass.Chart
to returntoNamedInputStreamEntries(Object)
,
load(hapi.chart.ChartOuterClass.Chart.Builder, Iterable)
public ChartOuterClass.Chart.Builder load(ChartOuterClass.Chart.Builder parent, Iterable<? extends Map.Entry<? extends String,? extends InputStream>> entrySet) throws IOException
ChartOuterClass.Chart
from the supplied notional set of
named InputStream
s and returns it.
This method never returns null
.
This method is called by the AbstractChartLoader.load(Object)
method.
entrySet
- the Iterable
of Map.Entry
instances
normally returned by the toNamedInputStreamEntries(Object)
method; must not be null
ChartOuterClass.Chart
; never null
NullPointerException
- if entrySet
is null
IOException
- if a problem is encountered while creating
the ChartOuterClass.Chart
to returntoNamedInputStreamEntries(Object)
,
AbstractChartLoader.load(Object)
protected void installConfig(ChartOuterClass.Chart.Builder chartBuilder, InputStream stream) throws IOException
ConfigOuterClass.Config
object, represented by the supplied
InputStream
, into the supplied Chart.Builder
.chartBuilder
- the Chart.Builder
to
affect; must not be null
stream
- an InputStream
representing valid
values file contents as defined by the
chart specification; must not be null
NullPointerException
- if chartBuilder
or stream
is null
IOException
- if there was a problem reading from the
supplied InputStream
ChartOuterClass.Chart.Builder.getValuesBuilder()
,
ConfigOuterClass.Config.Builder.setRawBytes(ByteString)
protected void installMetadata(ChartOuterClass.Chart.Builder chartBuilder, InputStream stream) throws IOException
MetadataOuterClass.Metadata
object, represented by the supplied
InputStream
, into the supplied Chart.Builder
.chartBuilder
- the Chart.Builder
to
affect; must not be null
stream
- an InputStream
representing valid
Chart.yaml
contents as defined by the
chart specification; must not be null
NullPointerException
- if chartBuilder
or stream
is null
IOException
- if there was a problem reading from the
supplied InputStream
ChartOuterClass.Chart.Builder.getMetadataBuilder()
,
MetadataOuterClass.Metadata.Builder
protected TemplateOuterClass.Template.Builder createTemplateBuilder(ChartOuterClass.Chart.Builder chartBuilder, InputStream stream, String name) throws IOException
TemplateOuterClass.Template.Builder
from the contents of the supplied InputStream
,
with the supplied name
, and returns it.
This method never returns null
.
chartBuilder
- a ChartOuterClass.Chart.Builder
whose ChartOuterClass.Chart.Builder.addTemplatesBuilder()
method will be called to create the new TemplateOuterClass.Template.Builder
instance; must
not be null
stream
- an InputStream
containing valid
template contents as defined by the chart
specification; must not be null
name
- the name for the new TemplateOuterClass.Template
that will
ultimately reside within the chart; must not be null
TemplateOuterClass.Template.Builder
; never null
NullPointerException
- if chartBuilder
, stream
or name
is null
IOException
- if there was a problem reading from the
supplied InputStream
TemplateOuterClass.Template.Builder
protected void installAny(ChartOuterClass.Chart.Builder chartBuilder, InputStream stream, String name) throws IOException
Any
object, representing an arbitrary chart
file with the supplied name
and represented by the
supplied InputStream
, into the supplied Chart.Builder
.chartBuilder
- the Chart.Builder
to
affect; must not be null
stream
- an InputStream
representing valid chart file
contents as defined by the chart
specification; must not be null
name
- the name of the file within the chart; must not be
null
NullPointerException
- if chartBuilder
or stream
or name
is null
IOException
- if there was a problem reading from the
supplied InputStream
ChartOuterClass.Chart.Builder.addFilesBuilder()
Copyright © 2017–2018, microBean. All rights reserved.