}
/**
- * Returns all Sones, remote and local.
- *
- * @return All Sones
+ * {@inheritDocs}
*/
- public Set<Sone> getSones() {
- return new HashSet<Sone>(sones.values());
+ @Override
+ public Collection<Sone> getSones() {
+ synchronized (sones) {
+ return Collections.unmodifiableCollection(sones.values());
+ }
}
/**
}
/**
- * Checks whether the core knows a Sone with the given ID.
- *
- * @param id
- * The ID of the Sone
- * @return {@code true} if there is a Sone with the given ID, {@code false}
- * otherwise
- */
- public boolean hasSone(String id) {
- synchronized (sones) {
- return sones.containsKey(id);
- }
- }
-
- /**
- * Returns all local Sones.
- *
- * @return All local Sones
+ * {@inheritDocs}
*/
+ @Override
public Collection<Sone> getLocalSones() {
synchronized (sones) {
return Collections2.filter(sones.values(), new Predicate<Sone>() {
}
/**
- * Returns all remote Sones.
- *
- * @return All remote Sones
+ * {@inheritDocs}
*/
+ @Override
public Collection<Sone> getRemoteSones() {
synchronized (sones) {
return Collections2.filter(sones.values(), new Predicate<Sone>() {
}
/**
+ * {@inheritDocs}
+ */
+ @Override
+ public Collection<Post> getPosts(String soneId) {
+ return postDatabase.getPosts(soneId);
+ }
+
+ /**
* {@inheritDoc}
*/
@Override
sone.setClient(new Client("Sone", SonePlugin.VERSION.toString()));
sone.setKnown(true);
/* TODO - load posts ’n stuff */
+ trustedIdentities.put(ownIdentity, Collections.synchronizedSet(new HashSet<Identity>()));
sones.put(ownIdentity.getId(), sone);
final SoneInserter soneInserter = new SoneInserter(this, eventBus, freenetInterface, sone);
soneInserters.put(sone, soneInserter);
}
}
synchronized (sones) {
+ sone.setOptions(storedSone.get().getOptions());
sones.put(sone.getId(), sone);
}
}
OwnIdentity ownIdentity = ownIdentityAddedEvent.ownIdentity();
logger.log(Level.FINEST, String.format("Adding OwnIdentity: %s", ownIdentity));
if (ownIdentity.hasContext("Sone")) {
- trustedIdentities.put(ownIdentity, Collections.synchronizedSet(new HashSet<Identity>()));
addLocalSone(ownIdentity);
}
}