use of org.openntf.domino.graph2.annotations.Shardable in project org.openntf.domino by OpenNTF.
the class DConfiguration method addElementStore.
@Override
public DElementStore addElementStore(final DElementStore store) throws IllegalStateException {
store.setConfiguration(this);
Long key = store.getStoreKey();
DElementStore schk = getElementStores().get(key);
DElementStore pchk = null;
DElementStore rpchk = null;
if (schk == null) {
getElementStores().put(key, store);
}
Long pkey = store.getProxyStoreKey();
if (pkey != null) {
pchk = getElementStores().get(pkey);
if (pchk == null) {
getElementStores().put(pkey, store);
}
}
Long rpkey = store.getReverseProxyStoreKey();
if (rpkey != null) {
rpchk = getElementStores().get(rpkey);
if (rpchk == null) {
getElementStores().put(rpkey, store);
}
}
List<Class<?>> types = store.getTypes();
for (Class<?> type : types) {
getTypeRegistry().add(type, store);
Long chk = getTypeMap().get(type);
if (chk != null) {
if (!chk.equals(key)) {
Shardable s = type.getAnnotation(Shardable.class);
if (s == null) {
throw new IllegalStateException("Element store has already been registered for type " + type.getName());
} else {
getTypeMap().put(type, key);
}
}
} else {
getTypeMap().put(type, key);
}
}
if (pchk != null) {
types = pchk.getTypes();
for (Class<?> type : types) {
getTypeRegistry().add(type, pchk);
Long chk = getTypeMap().get(type);
if (chk != null) {
if (!chk.equals(key)) {
Shardable s = type.getAnnotation(Shardable.class);
if (s == null) {
throw new IllegalStateException("Element store has already been registered for type " + type.getName());
} else {
getTypeMap().put(type, key);
}
}
} else {
getTypeMap().put(type, key);
}
}
}
if (rpchk != null) {
types = rpchk.getTypes();
for (Class<?> type : types) {
getTypeRegistry().add(type, rpchk);
Long chk = getTypeMap().get(type);
if (chk != null) {
if (!chk.equals(key)) {
Shardable s = type.getAnnotation(Shardable.class);
if (s == null) {
throw new IllegalStateException("Element store has already been registered for type " + type.getName());
} else {
getTypeMap().put(type, key);
}
}
} else {
getTypeMap().put(type, key);
}
}
}
return store;
}
Aggregations