RequestToDisconnectNodeDiagnosis diag = requestToDisconnectNodeDiagnosisIndex.getDiagnosis(id); if (diag != null) { if (logger.isDebugEnabled()) logger.debug("Not creating redundant modes & conditions for already known "+id.toString()); return true; }  try { diag = new RequestToDisconnectNodeDiagnosis(id.getName(), sb); try { diag.setValue(CONNECTED); requestToDisconnectNodeDiagnosisIndex.putDiagnosis(diag); blackboard.publishAdd(diag); if (logger.isDebugEnabled()) { logger.debug("Created: "+diag.dump()); } } catch (IllegalValueException e) { logger.error("Attempt to set: "+diag.toString()+" with illegal value "+e.toString()); return false; } } catch (TechSpecNotFoundException e) { logger.error("TechSpec not found for RequestToDisconnectNodeDiagnosis"); return false; }  try { NodeDisconnectAction action = new NodeDisconnectAction(id.getName(), NULL_SET, sb); HashSet offers = new HashSet(); action.setValuesOffered(offers); disconnectActionIndex.putAction(action); blackboard.publishAdd(action); if (logger.isDebugEnabled()) { logger.debug("Created: "+action.dump()); } } catch (IllegalValueException e) { logger.error(e.toString()); return false; } catch (TechSpecNotFoundException e) { logger.error("TechSpec not found for NodeDisconnectAction"); return false; } if (logger.isDebugEnabled()) logger.debug("Created Diagnosis & Action for: " + id.toString()); return true;
return createNodeDiagnosisAndAction(id, CONNECTED);
    private boolean createNodeDiagnosisAndAction(AssetID id) {        // create the Defense-Level Diagnosis & Action seen by the Coordinator        RequestToDisconnectNodeDiagnosis diag = requestToDisconnectNodeDiagnosisIndex.getDiagnosis(id);        if (diag != null) { // the DefenseApplicability condition already exists, so don't make anotherset of conditions & opmodes            if (logger.isDebugEnabled()) logger.debug("Not creating redundant modes & conditions for already known "+id.toString());            return true;        }        try {            diag = new RequestToDisconnectNodeDiagnosis(id.getName(), sb);            try {                diag.setValue(CONNECTED); // not disconnected                requestToDisconnectNodeDiagnosisIndex.putDiagnosis(diag);                blackboard.publishAdd(diag);                if (logger.isDebugEnabled()) { logger.debug("Created: "+diag.dump()); }            } catch (IllegalValueException e) {                logger.error("Attempt to set: "+diag.toString()+" with illegal value "+e.toString());                return false;            }        } catch (TechSpecNotFoundException e) {            logger.error("TechSpec not found for RequestToDisconnectNodeDiagnosis");            return false;        }        try {            NodeDisconnectAction action = new NodeDisconnectAction(id.getName(), NULL_SET, sb);            HashSet offers = new HashSet();            action.setValuesOffered(offers); // everything is allowed            disconnectActionIndex.putAction(action);            blackboard.publishAdd(action);            if (logger.isDebugEnabled()) { logger.debug("Created: "+action.dump()); }        } catch (IllegalValueException e) {            logger.error(e.toString());            return false;        } catch (TechSpecNotFoundException e) {            logger.error("TechSpec not found for NodeDisconnectAction");            return false;        }        if (logger.isDebugEnabled()) logger.debug("Created Diagnosis & Action for: " + id.toString());                return true;    }