public abstract class DataStore extends Object implements Localized, AutoCloseable
Defined in the sis-storage module
Modifier and Type | Field and Description |
---|---|
protected WarningListeners<DataStore> |
listeners
The set of registered
WarningListener s for this data store. |
Modifier | Constructor and Description |
---|---|
protected |
DataStore()
Creates a new instance with initially no listener.
|
Modifier and Type | Method and Description |
---|---|
void |
addWarningListener(WarningListener<? super DataStore> listener)
Adds a listener to be notified when a warning occurred while reading from or writing to the storage.
|
abstract void |
close()
Closes this data store and releases any underlying resources.
|
Locale |
getLocale()
The locale to use for formatting warnings and other messages.
|
abstract Metadata |
getMetadata()
Returns information about the dataset as a whole.
|
void |
removeWarningListener(WarningListener<? super DataStore> listener)
Removes a previously registered listener.
|
void |
setLocale(Locale locale)
Sets the locale to use for formatting warnings and other messages.
|
protected final WarningListeners<DataStore> listeners
WarningListener
s for this data store.protected DataStore()
public Locale getLocale()
The default value is the system default locale.
getLocale
in interface Localized
null
if not explicitly defined.CompoundFormat.getLocale()
public void setLocale(Locale locale)
locale
- The new locale to use.public abstract Metadata getMetadata() throws DataStoreException
null
if none.DataStoreException
- If an error occurred while reading the data.public void addWarningListener(WarningListener<? super DataStore> listener) throws IllegalArgumentException
Level.WARNING
.try
… finally
block if the DataStore
lifetime is longer than the listener lifetime, as below:
datastore.addWarningListener(listener); try { // Do some work... } finally { datastore.removeWarningListener(listener); }
listener
- The listener to add.IllegalArgumentException
- If the given listener is already registered in this data store.public void removeWarningListener(WarningListener<? super DataStore> listener) throws NoSuchElementException
listener
- The listener to remove.NoSuchElementException
- If the given listener is not registered in this data store.public abstract void close() throws DataStoreException
close
in interface AutoCloseable
DataStoreException
- If an error occurred while closing this data store.Copyright © 2010–2013 The Apache Software Foundation. All rights reserved.