/** * {@inheritDoc} * * @return {@inheritDoc} */ @Override public boolean isEnabled() { try { assert (getConfig() instanceof UnitConfig); return getConfig().getEnablingState().getValue().equals(EnablingState.State.ENABLED); } catch (CouldNotPerformException ex) { LoggerFactory.getLogger(org.openbase.bco.dal.lib.layer.unit.UnitRemote.class).warn("isEnabled() was called on non initialized unit!"); assert false; } return false; }
private static void updateUnitLabel(final List<String> unitIds) throws CouldNotPerformException, InterruptedException, ExecutionException { for (String unitId : unitIds) { UnitConfig tmp = unitRegistry.getUnitConfigById(unitId); // ignore disabled test unit otherwise they would registered twice with the same label if another enabled instance of the same class exists. if (tmp.getEnablingState().getValue().equals(EnablingState.State.DISABLED)) { continue; } unitRegistry.updateUnitConfig(tmp.toBuilder().setLabel(UNIT_TYPE_LABEL_MAP.get(tmp.getType())).build()).get(); } }
if (!unitConfig.getEnablingState().getValue().equals(EnablingStateType.EnablingState.State.ENABLED)) { continue;
private RdfTriple getInsertIsEnabledRelation(final UnitConfig unitConfig) throws NotAvailableException { if (unitConfig.getEnablingState().getValue().equals(State.ENABLED)) { return new RdfTriple(unitConfig.getId(), OntProp.IS_ENABLED.getName(), StringModifier.addQuotationMarks("true")); } else { return new RdfTriple(unitConfig.getId(), OntProp.IS_ENABLED.getName(), StringModifier.addQuotationMarks("false")); } }
private void verifyUnitConfig(final UnitConfig unitConfig) throws VerificationFailedException { if (!unitConfig.getEnablingState().getValue().equals(EnablingStateType.EnablingState.State.ENABLED)) { try { throw new VerificationFailedException("Referred Unit[" + ScopeGenerator.generateStringRep(unitConfig.getScope()) + "] is disabled!"); } catch (CouldNotPerformException ex) { ExceptionPrinter.printHistory(ex, LOGGER, LogLevel.WARN); throw new VerificationFailedException("Referred Unit[" + unitConfig.getLabel() + "] is disabled!"); } } }
@Override public boolean enablingCondition(UnitConfig config) { return config.getEnablingState().getValue().equals(EnablingStateType.EnablingState.State.ENABLED); } };
public boolean isEnabled() { try { return getConfig().getEnablingState().getValue().equals(EnablingState.State.ENABLED); } catch (CouldNotPerformException ex) { ExceptionPrinter.printHistory(ex, logger); } return false; }