|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.binaryfantasy.murq.MurqSource
public final class MurqSource
An ISource wrapper that manages the
raw interaction with the persistance layer. Functions performed by this
class include:
ISource to provide
caching and encryption if required.
ContentIndex,Links
and ISourceIO
lock needed to
ensure it.
SourceEvent
dispatching.
FOR INTERNAL USE ONLY.
| Method Summary | |
|---|---|
void |
add(ISource src)
|
void |
add(ISource src,
String password)
|
void |
addSourceListener(ISourceListener listener)
Adds a listener to be notified of SourceEvents. |
void |
addSourceListener(ISourceListener listener,
Executor executor)
Adds a listener to be notified of SourceEvents using the specified
Executor. |
void |
close()
Called when a source is no longer to be used and provides a chance for clean up and release of resources. |
IContent |
get(SourceKey key)
Returns the content associated with the specified key,
or null if no content is found. |
ContentDirectory |
getDirectory()
|
String |
getId()
Returns the unique identifier for the raw ISource. |
ContentIndex |
getIndex()
|
InputStream |
getInputStream(String key)
Returns a stream to read the content specified by the key,
or null if no content is associated with the
key. |
static MurqSource |
getInstance(ISource source)
Returns a MurqSource used to interact with the
unencrypted source. |
static MurqSource |
getInstance(ISource src,
String password)
Returns a MurqSource used to interact with the
source. |
Set<String> |
getKeys()
Returns a Set of all current keys in this source, or an
empty Set if there are none. |
com.binaryfantasy.murq.Links |
getLinks()
Returns the Links used to manage content links for the
ISource. |
ReentrantReadWriteLock |
getLock()
|
OutputStream |
getOutputStream(String key)
Returns a stream to write the content associated with the key. |
ISourceIO |
getSourceIO()
|
void |
put(IContent content,
boolean force,
boolean index)
Persists the specified content, ignoring any possible
concurrent modification issues if force is
true. |
int |
read(SourceKey key,
OutputStream out)
Reads the default binary data associated with the key and
writes it to the specified out. |
boolean |
remove(SourceKey key)
Removes the content specified by the key. |
boolean |
remove(String key)
Returns true if the content mapped to the provided
key was removed, false if no content is
associated with the key. |
void |
removeSourceListener(ISourceListener listener)
Removes a listener from being notified of SourceEvents. |
int |
write(IBinaryContent content,
InputStream in,
boolean force,
boolean index)
Persists the specified binary data from the in along with
the metadata describing it in the content, ignoring any
possible concurrent modification issues if force is
true. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static MurqSource getInstance(ISource source)
MurqSource used to interact with the
unencrypted source. If source is an
instance of MurqSource, it will simply be returned.
source - the raw ISource to be
used.
MurqSource used to interact with the
unencrypted source.
InvalidPasswordException - if source is encrypted.
public static MurqSource getInstance(ISource src,
String password)
MurqSource used to interact with the
source. If source is an instance of
MurqSource, it will simply be returned.
src - the raw ISource to be
used.password - the password needed to decrypt the source, or
null if the source is not
encrypted.
MurqSource used to interact with the
source.
InvalidPasswordException - if password is not valid.public void addSourceListener(ISourceListener listener)
SourceEvents.
listener - the listener to be notified of
SourceEvents.
public void addSourceListener(ISourceListener listener,
Executor executor)
SourceEvents using the specified
Executor.
listener - the listener to be notified of
SourceEvents.executor - the Executor used to fire events.public void removeSourceListener(ISourceListener listener)
SourceEvents.
listener - the listener to be removed from being notified of
SourceEvents.public String getId()
ISource.
ISource.public com.binaryfantasy.murq.Links getLinks()
Links used to manage content links for the
ISource.
Links used to manage content links for the
ISource.public ISourceIO getSourceIO()
public ContentIndex getIndex()
public ContentDirectory getDirectory()
public ReentrantReadWriteLock getLock()
public Set<String> getKeys()
ISourceSet of all current keys in this source, or an
empty Set if there are none.
getKeys in interface ISourceSet of all current keys in this source, or an
empty Set if there are none.public boolean remove(SourceKey key)
key.
key - key associated with the content to be removed.
true if successful, false
otherwise.public boolean remove(String key)
ISourcetrue if the content mapped to the provided
key was removed, false if no content is
associated with the key.
remove in interface ISourcekey - unique value associated with the content.
true if the content mapped to the provided
key was removed, false if no
content is associated with the key.public IContent get(SourceKey key)
key,
or null if no content is found.
key - key associated with the content to be returned.
key,
or null if no content is found.
public int read(SourceKey key,
OutputStream out)
key and
writes it to the specified out.
key - the key associated with the binary data to be read.out - destination of the read binary data.
public InputStream getInputStream(String key)
ISourcekey,
or null if no content is associated with the
key.
getInputStream in interface ISourcekey - unique value associated with the content.
key,
or null if no content is associated with the
key.
public void put(IContent content,
boolean force,
boolean index)
content, ignoring any possible
concurrent modification issues if force is
true.
Content is considered to be new if
IContent.getContentId() returns
null. In this case, a unique id will be set, both in the
persisted copy and the content passed in. New content
also has it's creationDate set.
All content, new or updated, has it's lastModified date
updated.
content - the content to be persisted.force - set to true to ignore concurent modification
checks.index - set to false if object should not be indexed,
true otherwise.
ConcurrentModificationException - if force is false and
content already exists and is an older
version than the one already persisted.
public int write(IBinaryContent content,
InputStream in,
boolean force,
boolean index)
in along with
the metadata describing it in the content, ignoring any
possible concurrent modification issues if force is
true.
content - the metadata content describing the binary data.in - binary data to read and persist.force - set to true to ignore concurent modification
checks.index - set to false if metadata should not be
indexed.
ConcurrentModificationException - if force is false and
content already exists and is an older
version than the one already persisted.public OutputStream getOutputStream(String key)
ISourcekey.
getOutputStream in interface ISourcekey - unique value associated with the content.
key.public void close()
ISource
close in interface ISourcepublic void add(ISource src)
public void add(ISource src,
String password)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||