org.kitesdk.data
Class Datasets

java.lang.Object
  extended by org.kitesdk.data.Datasets

public class Datasets
extends Object

Convenience methods for working with Dataset instances.

Since:
0.8.0

Constructor Summary
Datasets()
           
 
Method Summary
static
<V extends View<GenericRecord>>
V
create(String uri, DatasetDescriptor descriptor)
          Create a Dataset for the given dataset or view URI string.
static
<E,V extends View<E>>
V
create(String uri, DatasetDescriptor descriptor, Class<E> type)
          Create a Dataset for the given dataset or view URI string.
static
<V extends View<GenericRecord>>
V
create(URI uri, DatasetDescriptor descriptor)
          Create a Dataset for the given dataset or view URI.
static
<E,V extends View<E>>
V
create(URI uri, DatasetDescriptor descriptor, Class<E> type)
          Create a Dataset for the given dataset or view URI.
static boolean delete(String uri)
          Delete a Dataset identified by the given dataset URI string.
static boolean delete(URI uri)
          Delete a Dataset identified by the given dataset URI.
static boolean exists(String uri)
          Check if a Dataset identified by the given URI string exists.
static boolean exists(URI uri)
          Check if a Dataset identified by the given URI exists.
static Collection<URI> list(String uri)
          List the Dataset URIs in the repository identified by the URI string
static Collection<URI> list(URI uri)
          List the Dataset URIs in the repository identified by the URI
static
<V extends View<GenericRecord>>
V
load(String uriString)
          Load a Dataset or View for the given URI string.
static
<E,V extends View<E>>
V
load(String uriString, Class<E> type)
          Load a Dataset or View for the given URI string.
static
<V extends View<GenericRecord>>
V
load(URI uri)
          Load a Dataset or View for the given URI.
static
<E,V extends View<E>>
V
load(URI uri, Class<E> type)
          Load a Dataset or View for the given URI.
static
<R extends DatasetRepository>
R
repositoryFor(String uriString)
          Load a DatasetRepository for the given dataset or view URI string.
static
<R extends DatasetRepository>
R
repositoryFor(URI uri)
          Load a DatasetRepository for the given dataset or view URI.
static
<D extends Dataset<GenericRecord>>
D
update(String uri, DatasetDescriptor descriptor)
          Update a Dataset for the given dataset or view URI string.
static
<E,D extends Dataset<E>>
D
update(String uri, DatasetDescriptor descriptor, Class<E> type)
          Update a Dataset for the given dataset or view URI string.
static
<D extends Dataset<GenericRecord>>
D
update(URI uri, DatasetDescriptor descriptor)
          Update a Dataset for the given dataset or view URI.
static
<E,D extends Dataset<E>>
D
update(URI uri, DatasetDescriptor descriptor, Class<E> type)
          Update a Dataset for the given dataset or view URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Datasets

public Datasets()
Method Detail

load

public static <E,V extends View<E>> V load(URI uri,
                                           Class<E> type)
Load a Dataset or View for the given URI.

If the URI is a dataset URI, the unfiltered Dataset will be returned.

URI formats are defined by Dataset implementations, but must begin with "dataset:" or "view:".

Type Parameters:
E - The type of entities stored in the Dataset.
V - The type of View expected.
Parameters:
uri - a Dataset or View URI.
type - the Java type of the entities in the dataset
Returns:
a View for the given URI.

load

public static <V extends View<GenericRecord>> V load(URI uri)
Load a Dataset or View for the given URI.

If the URI is a dataset URI, the unfiltered Dataset will be returned.

URI formats are defined by Dataset implementations, but must begin with "dataset:" or "view:".

Type Parameters:
V - The type of View expected.
Parameters:
uri - a Dataset or View URI.
Returns:
a View for the given URI.

load

public static <E,V extends View<E>> V load(String uriString,
                                           Class<E> type)
Load a Dataset or View for the given URI string.

If the URI is a dataset URI, the unfiltered Dataset will be returned.

URI formats are defined by Dataset implementations, but must begin with "dataset:" or "view:".

Type Parameters:
E - The type of entities stored in the Dataset.
V - The type of View expected.
Parameters:
uriString - a Dataset or View URI.
type - the Java type of the entities in the dataset
Returns:
a View for the given URI.

load

public static <V extends View<GenericRecord>> V load(String uriString)
Load a Dataset or View for the given URI string.

If the URI is a dataset URI, the unfiltered Dataset will be returned.

URI formats are defined by Dataset implementations, but must begin with "dataset:" or "view:".

Type Parameters:
V - The type of View expected.
Parameters:
uriString - a Dataset or View URI.
Returns:
a View for the given URI.

repositoryFor

public static <R extends DatasetRepository> R repositoryFor(URI uri)
Load a DatasetRepository for the given dataset or view URI.

URI formats are defined by Dataset implementations, but must begin with "dataset:" or "view:".

Type Parameters:
R - The type of DatasetRepository expected.
Parameters:
uri - a Dataset or View URI.
Returns:
a DatasetRepository responsible for the given URI.

repositoryFor

public static <R extends DatasetRepository> R repositoryFor(String uriString)
Load a DatasetRepository for the given dataset or view URI string.

URI formats are defined by Dataset implementations, but must begin with "dataset:" or "view:".

Type Parameters:
R - The type of DatasetRepository expected.
Parameters:
uriString - a Dataset or View URI.
Returns:
a DatasetRepository responsible for the given URI.

create

public static <E,V extends View<E>> V create(URI uri,
                                             DatasetDescriptor descriptor,
                                             Class<E> type)
Create a Dataset for the given dataset or view URI.

URI formats are defined by Dataset implementations, but must begin with "dataset:" or "view:".

Type Parameters:
E - The type of entities stored in the Dataset.
V - The type of Dataset or View expected.
Parameters:
uri - a Dataset or View URI.
type - the Java type of the entities in the dataset
Returns:
a newly created Dataset responsible for the given URI.

create

public static <V extends View<GenericRecord>> V create(URI uri,
                                                       DatasetDescriptor descriptor)
Create a Dataset for the given dataset or view URI.

URI formats are defined by Dataset implementations, but must begin with "dataset:" or "view:".

Type Parameters:
V - The type of Dataset or View expected.
Parameters:
uri - a Dataset or View URI.
Returns:
a newly created Dataset responsible for the given URI.

create

public static <E,V extends View<E>> V create(String uri,
                                             DatasetDescriptor descriptor,
                                             Class<E> type)
Create a Dataset for the given dataset or view URI string.

URI formats are defined by Dataset implementations, but must begin with "dataset:" or "view:".

Type Parameters:
E - The type of entities stored in the Dataset.
V - The type of Dataset or View expected.
Parameters:
uri - a Dataset or View URI string.
type - the Java type of the entities in the dataset
Returns:
a newly created Dataset responsible for the given URI.

create

public static <V extends View<GenericRecord>> V create(String uri,
                                                       DatasetDescriptor descriptor)
Create a Dataset for the given dataset or view URI string.

URI formats are defined by Dataset implementations, but must begin with "dataset:" or "view:".

Type Parameters:
V - The type of Dataset or View expected.
Parameters:
uri - a Dataset or View URI string.
Returns:
a newly created Dataset responsible for the given URI.

update

public static <E,D extends Dataset<E>> D update(URI uri,
                                                DatasetDescriptor descriptor,
                                                Class<E> type)
Update a Dataset for the given dataset or view URI.

URI formats are defined by Dataset implementations, but must begin with "dataset:" or "view:".

Type Parameters:
E - The type of entities stored in the Dataset.
D - The type of Dataset expected.
Parameters:
uri - a Dataset or View URI.
type - the Java type of the entities in the dataset
Returns:
a newly created Dataset responsible for the given URI.

update

public static <D extends Dataset<GenericRecord>> D update(URI uri,
                                                          DatasetDescriptor descriptor)
Update a Dataset for the given dataset or view URI.

URI formats are defined by Dataset implementations, but must begin with "dataset:" or "view:".

Type Parameters:
D - The type of Dataset expected.
Parameters:
uri - a Dataset or View URI.
Returns:
a newly created Dataset responsible for the given URI.

update

public static <E,D extends Dataset<E>> D update(String uri,
                                                DatasetDescriptor descriptor,
                                                Class<E> type)
Update a Dataset for the given dataset or view URI string.

URI formats are defined by Dataset implementations, but must begin with "dataset:" or "view:".

Type Parameters:
E - The type of entities stored in the Dataset.
D - The type of Dataset expected.
Parameters:
uri - a Dataset or View URI string.
type - the Java type of the entities in the dataset
Returns:
a newly created Dataset responsible for the given URI.

update

public static <D extends Dataset<GenericRecord>> D update(String uri,
                                                          DatasetDescriptor descriptor)
Update a Dataset for the given dataset or view URI string.

URI formats are defined by Dataset implementations, but must begin with "dataset:" or "view:".

Type Parameters:
D - The type of Dataset expected.
Parameters:
uri - a Dataset or View URI string.
Returns:
a newly created Dataset responsible for the given URI.

delete

public static boolean delete(URI uri)
Delete a Dataset identified by the given dataset URI.

URI formats are defined by Dataset implementations, but must begin with "dataset:".

Parameters:
uri - a Dataset URI.
Returns:
true if any data or metadata was removed, or false

delete

public static boolean delete(String uri)
Delete a Dataset identified by the given dataset URI string.

URI formats are defined by Dataset implementations, but must begin with "dataset:".

Parameters:
uri - a Dataset URI string.
Returns:
true if any data or metadata was removed, or false

exists

public static boolean exists(URI uri)
Check if a Dataset identified by the given URI exists.

URI formats are defined by Dataset implementations, but must begin with "dataset:".

Parameters:
uri - a Dataset URI.
Returns:
true if the dataset exists, false otherwise

exists

public static boolean exists(String uri)
Check if a Dataset identified by the given URI string exists.

URI formats are defined by Dataset implementations, but must begin with "dataset:".

Parameters:
uri - a Dataset URI string.
Returns:
true if the dataset exists, false otherwise

list

public static Collection<URI> list(URI uri)
List the Dataset URIs in the repository identified by the URI

URI formats are defined by Dataset implementations. The repository URIs passed to this method must begin with "repo:".

Parameters:
uri - a DatasetRepository URI
Returns:
the URIs present in the DatasetRepository

list

public static Collection<URI> list(String uri)
List the Dataset URIs in the repository identified by the URI string

URI formats are defined by Dataset implementations. The repository URIs passed to this method must begin with "repo:".

Parameters:
uri - a DatasetRepository URI string
Returns:
the URIs present in the DatasetRepository


Copyright © 2013–2014. All rights reserved.