public static String generateStringRep(final Collection<String> components) throws CouldNotPerformException { try { String stringRep = Scope.COMPONENT_SEPARATOR; for (String component : components) { stringRep += component; stringRep += Scope.COMPONENT_SEPARATOR; } return stringRep; } catch (RuntimeException ex) { throw new CouldNotPerformException("Could not generate scope string representation!", ex); } }
@Override public <ReplyType, RequestType> ReplyType call(String name, RequestType data, double timeout) throws CouldNotPerformException { throw new CouldNotPerformException("Could not call Method["+name+"]!", new InvalidStateException("RemoteServer not initialized!")); } }
@Override public Future<UnitConfig> registerUserConfig(final UnitConfig userConfig) throws CouldNotPerformException { try { return new RegistrationFuture<>(RPCHelper.callRemoteMethod(userConfig, this, UnitConfig.class), userConfigRemoteRegistry, this); } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not register user config!", ex); } }
@Override public Boolean isAgentUnitRegistryConsistent() throws CouldNotPerformException { try { validateData(); return getData().getAgentUnitConfigRegistryConsistent(); } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not check consistency!", ex); } }
public static String generateStringRep(final ScopeType.Scope scope) throws CouldNotPerformException { try { if (scope == null) { throw new NotAvailableException("scope"); } return generateStringRep(scope.getComponentList()); } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not generate scope string representation!", ex); } }
@Override protected Boolean getPropertyDefaultValue() { try { return JPService.getProperty(JPReset.class).getValue(); } catch (JPNotAvailableException ex) { ExceptionPrinter.printHistory(new CouldNotPerformException("Could not access JPReset property", ex), logger); return false; } }
@Override public Future<ActionFuture> setActivationState(final ActivationState activationState) throws CouldNotPerformException { ActionDescription.Builder actionDescription = ActionDescriptionProcessor.getActionDescription(ActionAuthority.getDefaultInstance(), ResourceAllocation.Initiator.SYSTEM); try { return applyAction(Services.updateActionDescription(actionDescription, activationState, getServiceType()).build()); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new CouldNotPerformException("Could not set activationState", ex); } }
@Override public Future<ActionFutureType.ActionFuture> setEmphasisState(EmphasisState emphasisState) throws CouldNotPerformException { ActionDescription.Builder actionDescription = ActionDescriptionProcessor.getActionDescription(ActionAuthority.getDefaultInstance(), ResourceAllocation.Initiator.SYSTEM); try { return applyAction(Services.updateActionDescription(actionDescription, emphasisState, getServiceType()).build()); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new CouldNotPerformException("Could not set brightnessState", ex); } }
@Override public Future<ActionFuture> setActivationState(final ActivationState activationState) throws CouldNotPerformException { logger.info("Calling remote setActivationState to [" + activationState.getValue() + "] for agent"); ActionDescription.Builder actionDescription = ActionDescriptionProcessor.getActionDescription(ActionAuthority.getDefaultInstance(), ResourceAllocation.Initiator.SYSTEM); try { return applyAction(updateActionDescription(actionDescription, activationState, ServiceType.ACTIVATION_STATE_SERVICE).build()); } catch (InterruptedException ex) { throw new CouldNotPerformException("Interrupted while setting activationState.", ex); } }
@Override public Future<ActionFuture> setStandbyState(final StandbyState standbyState, final UnitType unitType) throws CouldNotPerformException { ActionDescription.Builder actionDescription = ActionDescriptionProcessor.getActionDescription(ActionAuthority.getDefaultInstance(), ResourceAllocation.Initiator.SYSTEM); ServiceStateDescription.Builder serviceStateDescription = actionDescription.getServiceStateDescriptionBuilder(); serviceStateDescription.setUnitType(unitType); try { return applyAction(Services.updateActionDescription(actionDescription, standbyState, getServiceType()).build()); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new CouldNotPerformException("Could not set standbyState", ex); } }
@Override public Future<ActionFuture> setBlindState(BlindState blindState) throws CouldNotPerformException { ActionDescription.Builder actionDescription = ActionDescriptionProcessor.getActionDescription(ActionAuthority.getDefaultInstance(), ResourceAllocation.Initiator.SYSTEM); try { return applyAction(updateActionDescription(actionDescription, blindState, ServiceType.BLIND_STATE_SERVICE).build()); } catch (InterruptedException ex) { throw new CouldNotPerformException("Interrupted while setting powerState.", ex); } }
@Override public Future<ActionFuture> setBrightnessState(BrightnessState brightnessState) throws CouldNotPerformException { ActionDescription.Builder actionDescription = ActionDescriptionProcessor.getActionDescription(ActionAuthority.getDefaultInstance(), ResourceAllocation.Initiator.SYSTEM); try { return applyAction(updateActionDescription(actionDescription, brightnessState, ServiceType.BRIGHTNESS_STATE_SERVICE).build()); } catch (InterruptedException ex) { throw new CouldNotPerformException("Interrupted while setting brightnessState.", ex); } }
@Override public Future<ActionFuture> setPowerState(final PowerState powerState) throws CouldNotPerformException { ActionDescription.Builder actionDescription = ActionDescriptionProcessor.getActionDescription(ActionAuthority.getDefaultInstance(), ResourceAllocation.Initiator.SYSTEM); try { return applyAction(updateActionDescription(actionDescription, powerState, ServiceType.POWER_STATE_SERVICE).build()); } catch (InterruptedException ex) { throw new CouldNotPerformException("Interrupted while setting powerState.", ex); } }
@Override public Future<ActionFuture> setPowerState(final PowerState powerState) throws CouldNotPerformException { ActionDescription.Builder actionDescription = ActionDescriptionProcessor.getActionDescription(ActionAuthority.getDefaultInstance(), ResourceAllocation.Initiator.SYSTEM); try { return applyAction(updateActionDescription(actionDescription, powerState, ServiceType.POWER_STATE_SERVICE).build()); } catch (InterruptedException ex) { throw new CouldNotPerformException("Interrupted while setting powerState.", ex); } }
@Override public Future<ActionFuture> setStandbyState(StandbyState standbyState) throws CouldNotPerformException { ActionDescription.Builder actionDescription = ActionDescriptionProcessor.getActionDescription(ActionAuthority.getDefaultInstance(), ResourceAllocation.Initiator.SYSTEM); try { return applyAction(updateActionDescription(actionDescription, standbyState, ServiceType.STANDBY_STATE_SERVICE).build()); } catch (InterruptedException ex) { throw new CouldNotPerformException("Interrupted while setting powerState.", ex); } } }
@Override public Future<ActionFuture> setTargetTemperatureState(final TemperatureState temperatureState) throws CouldNotPerformException { ActionDescription.Builder actionDescription = ActionDescriptionProcessor.getActionDescription(ActionAuthority.getDefaultInstance(), ResourceAllocation.Initiator.SYSTEM); try { return applyAction(updateActionDescription(actionDescription, temperatureState, ServiceType.TARGET_TEMPERATURE_STATE_SERVICE).build()); } catch (InterruptedException ex) { throw new CouldNotPerformException("Interrupted while setting temperatureState.", ex); } }
@Override public Future<ActionFuture> setUserPresenceState(UserPresenceState userPresenceState) throws CouldNotPerformException { //TODO: services for Users have to registered, see dal issue 44 ActionDescription.Builder actionDescription = ActionDescriptionProcessor.getActionDescription(ActionAuthority.getDefaultInstance(), ResourceAllocation.Initiator.SYSTEM); try { return applyAction(updateActionDescription(actionDescription, userPresenceState, ServiceType.USER_PRESENCE_STATE_SERVICE).build()); } catch (InterruptedException ex) { throw new CouldNotPerformException("Interrupted while setting activationState.", ex); } // return RPCHelper.callRemoteMethod(userPresenceState, this, Void.class); } }
private AuthenticatedServerManager() throws CouldNotPerformException, InterruptedException { try { this.ticketValidityTime = JPService.getProperty(JPSessionTimeout.class).getValue(); if (JPService.getProperty(JPAuthentication.class).getValue()) { this.login(); this.requestServiceServerSecretKey(); } } catch (JPNotAvailableException ex) { throw new CouldNotPerformException("Could not check JPProperty", ex); } }
@Override public Boolean isAuthorizationGroupUnitRegistryReadOnly() throws CouldNotPerformException { validateData(); try { if (JPService.getProperty(JPReadOnly.class).getValue() || !isConnected()) { return true; } } catch (JPServiceException ex) { ExceptionPrinter.printHistory(new CouldNotPerformException("Could not access java property!", ex), logger); } return getData().getAuthorizationGroupUnitConfigRegistryReadOnly(); }
@Override public Boolean isDeviceUnitRegistryReadOnly() throws CouldNotPerformException { validateData(); try { if (JPService.getProperty(JPReadOnly.class).getValue() || !isConnected()) { return true; } } catch (JPServiceException ex) { ExceptionPrinter.printHistory(new CouldNotPerformException("Could not access java property!", ex), logger); } return getData().getDeviceUnitConfigRegistryReadOnly(); }