org.gcube.data.streams.dsl
Class Streams

java.lang.Object
  extended by org.gcube.data.streams.dsl.Streams

public class Streams
extends Object

The definitions of an eDSL of stream and stream-related expressions.

Author:
Fabio Simeoni

Field Summary
static FaultHandler IGNORE_POLICY
          Returns a IgnoreHandler for failure handling.
static NoOpGenerator<String> no_serialiser
          Return a NoOpGenerator.
static FaultHandler RETHROW_POLICY
          Returns a RethrowHandler for failure handling.
static FaultHandler RETHROW_UNRECOVERABLE_POLICY
          Returns a RethrowUnrecoverableHandler for failure handling.
static FaultHandler STOPFAST_POLICY
          Returns a StopFastHandler for failure handling.
 
Constructor Summary
Streams()
           
 
Method Summary
static
<E> Stream<E>
convert(Iterable<E> iterable)
          Adapts an Iterable to a Stream.
static
<E> Stream<E>
convert(Iterator<E> itarator)
          Adapts an Iterator to a Stream.
static
<E> IteratorStream<E>
convert(IteratorAdapter<E> adapter)
          Adapts an Iterator to a Stream using a custom IteratorAdapter.
static RsOfClause<gr.uoa.di.madgik.grs.record.Record> convert(URI locator)
          Starts a sentence to convert a resultset into a Stream.
static
<E> InClause<E>
fold(Stream<E> stream)
          Starts a sentence to produce a Stream that groups of elements of another Stream.
static
<E> GuardWithClause<E>
guard(Stream<E> stream)
          Starts a sentence to produce a Stream that controls the error raised by another Stream.
static
<E> Stream<E>
log(Stream<E> stream)
          Returns a Stream that logs the throughput of an input Stream.
static
<E> MonitorWithClause<E>
monitor(Stream<E> stream)
          Starts a sentence to produce a Stream that notifies key events in the iteration of another Stream.
static
<E> NoOpGenerator<E>
no_op(Stream<E> stream)
          Return a NoOpGenerator.
static
<E> PipeThroughClause<E>
pipe(Stream<E> stream)
          Starts a sentence to produce a Stream generated from another Stream.
static
<E> PublishRsUsingClause<E>
publish(Stream<E> stream)
          Starts a sentence to publish a Stream as a resultset.
static PublishRsWithClause<String> publishStringsIn(Stream<String> stream)
          Starts a sentence to publish a Stream as a resultset.
static Stream<String> stringsIn(URI locator)
          Returns a Stream of strings extracted from a resultset of RsStringRecordFactory.STRING_RECORDs.
static
<E> UnfoldThroughClause<E>
unfold(Stream<E> stream)
          Starts a sentence to produce a Stream that unfolds the elements of another Stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

no_serialiser

public static NoOpGenerator<String> no_serialiser
Return a NoOpGenerator.


RETHROW_POLICY

public static FaultHandler RETHROW_POLICY
Returns a RethrowHandler for failure handling.


RETHROW_UNRECOVERABLE_POLICY

public static FaultHandler RETHROW_UNRECOVERABLE_POLICY
Returns a RethrowUnrecoverableHandler for failure handling.


STOPFAST_POLICY

public static FaultHandler STOPFAST_POLICY
Returns a StopFastHandler for failure handling.


IGNORE_POLICY

public static FaultHandler IGNORE_POLICY
Returns a IgnoreHandler for failure handling.

Constructor Detail

Streams

public Streams()
Method Detail

convert

public static <E> Stream<E> convert(Iterator<E> itarator)
Adapts an Iterator to a Stream.

Parameters:
itarator - the iterator
Returns:
the stream

convert

public static <E> IteratorStream<E> convert(IteratorAdapter<E> adapter)
Adapts an Iterator to a Stream using a custom IteratorAdapter.

Parameters:
adapter - the adapter
Returns:
the stream

convert

public static <E> Stream<E> convert(Iterable<E> iterable)
Adapts an Iterable to a Stream.

Parameters:
iterable - the iterable
Returns:
the stream

convert

public static RsOfClause<gr.uoa.di.madgik.grs.record.Record> convert(URI locator)
Starts a sentence to convert a resultset into a Stream.

Parameters:
locator - the locator of the resultset
Returns:
the next clause of the sentence

stringsIn

public static Stream<String> stringsIn(URI locator)
Returns a Stream of strings extracted from a resultset of RsStringRecordFactory.STRING_RECORDs.

Parameters:
locator - the locator of the resultset
Returns:
the stream

pipe

public static <E> PipeThroughClause<E> pipe(Stream<E> stream)
Starts a sentence to produce a Stream generated from another Stream.

Parameters:
stream - the input stream.
Returns:
the next clause of the sentence

fold

public static <E> InClause<E> fold(Stream<E> stream)
Starts a sentence to produce a Stream that groups of elements of another Stream.

Parameters:
stream - the input stream.
Returns:
the next clause of the sentence

unfold

public static <E> UnfoldThroughClause<E> unfold(Stream<E> stream)
Starts a sentence to produce a Stream that unfolds the elements of another Stream.

Parameters:
stream - the input stream.
Returns:
the next clause of the sentence

guard

public static <E> GuardWithClause<E> guard(Stream<E> stream)
Starts a sentence to produce a Stream that controls the error raised by another Stream.

Parameters:
stream - the input stream.
Returns:
the next clause of the sentence

monitor

public static <E> MonitorWithClause<E> monitor(Stream<E> stream)
Starts a sentence to produce a Stream that notifies key events in the iteration of another Stream.

Parameters:
stream - the input stream.
Returns:
the next clause of the sentence

publish

public static <E> PublishRsUsingClause<E> publish(Stream<E> stream)
Starts a sentence to publish a Stream as a resultset.

Parameters:
stream - the stream
Returns:
the next clause of the sentence

publishStringsIn

public static PublishRsWithClause<String> publishStringsIn(Stream<String> stream)
Starts a sentence to publish a Stream as a resultset.

Parameters:
stream - the stream
Returns:
the next clause of the sentence

log

public static <E> Stream<E> log(Stream<E> stream)
Returns a Stream that logs the throughput of an input Stream.

Parameters:
stream - the input stream
Returns:
the output stream

no_op

public static <E> NoOpGenerator<E> no_op(Stream<E> stream)
Return a NoOpGenerator.

Returns:
the generator


Copyright © 2012. All Rights Reserved.