Example #1
0
 public void knowledgeWritten(String knowledgePath) {
   if (!notifying) {
     String[] dPath = KnowledgePathHelper.decomposePath(knowledgePath);
     if (dPath.length > 0) {
       String current = null;
       int i = 0;
       do {
         current = KnowledgePathHelper.appendToRoot(current, dPath[i]);
         if (!toNotify.contains(current)) toNotify.add(current);
         i++;
       } while (i < dPath.length);
       if (dPath.length > 0 && !roots.contains(dPath[0])) roots.add(dPath[0]);
     }
   }
 }
Example #2
0
 public void notifyAboutChanges(TransactionalSession session) {
   notifying = true;
   String listenPath;
   String newVersion = KnowledgePathHelper.appendToRoot(UUID.randomUUID().toString(), getOwner());
   try {
     for (String path : toNotify) {
       listenPath = KnowledgePathHelper.prependToRoot(path, ConstantKeys.LISTEN_ID);
       updateVersion(listenPath, session, newVersion);
       listenPath =
           KnowledgePathHelper.prependToRoot(
               KnowledgePathHelper.replaceHead(path, EEnsembleParty.COORDINATOR.toString()),
               ConstantKeys.LISTEN_ID);
       updateVersion(listenPath, session, newVersion);
       listenPath =
           KnowledgePathHelper.prependToRoot(
               KnowledgePathHelper.replaceHead(path, EEnsembleParty.MEMBER.toString()),
               ConstantKeys.LISTEN_ID);
       updateVersion(listenPath, session, newVersion);
     }
   } catch (KRExceptionAccessError kre) {
     Log.e("Knowledge Repository communication exception", kre);
   }
   notifying = false;
 }