protected T createServiceInstance() throws Exception { if (serviceClass == null) { throw new IllegalStateException("Subclass has to provide service class or override createServiceInstance()"); } try { // Use this constructor if possible return serviceClass.getConstructor(LocalService.class).newInstance(getService()); } catch (NoSuchMethodException ex) { log.fine("Creating new service implementation instance with no-arg constructor: " + serviceClass.getName()); return serviceClass.newInstance(); } }
protected Collection<StateVariableValue> getCurrentState(String[] variableNames) throws Exception { lock(); try { Collection<StateVariableValue> values = new ArrayList<>(); for (String variableName : variableNames) { variableName = variableName.trim(); StateVariable stateVariable = getService().getStateVariable(variableName); if (stateVariable == null || !stateVariable.getEventDetails().isSendEvents()) { log.fine("Ignoring unknown or non-evented state variable: " + variableName); continue; } StateVariableAccessor accessor = getService().getAccessor(stateVariable); if (accessor == null) { log.warning("Ignoring evented state variable without accessor: " + variableName); continue; } values.add(accessor.read(stateVariable, getImplementation())); } return values; } finally { unlock(); } }
@Override public Collection<StateVariableValue> getCurrentState() throws Exception { lock(); try { Collection<StateVariableValue> values = readInitialEventedStateVariableValues(); if (values != null) { log.fine("Obtained initial state variable values for event, skipping individual state variable accessors"); return values; } values = new ArrayList<>(); for (StateVariable stateVariable : getService().getStateVariables()) { if (stateVariable.getEventDetails().isSendEvents()) { StateVariableAccessor accessor = getService().getAccessor(stateVariable); if (accessor == null) throw new IllegalStateException("No accessor for evented state variable"); values.add(accessor.read(stateVariable, getImplementation())); } } return values; } finally { unlock(); } }
protected T createServiceInstance() throws Exception { if (serviceClass == null) { throw new IllegalStateException("Subclass has to provide service class or override createServiceInstance()"); } try { // Use this constructor if possible return serviceClass.getConstructor(LocalService.class).newInstance(getService()); } catch (NoSuchMethodException ex) { log.fine("Creating new service implementation instance with no-arg constructor: " + serviceClass.getName()); return serviceClass.newInstance(); } }
protected Collection<StateVariableValue> getCurrentState(String[] variableNames) throws Exception { lock(); try { Collection<StateVariableValue> values = new ArrayList<StateVariableValue>(); for (String variableName : variableNames) { variableName = variableName.trim(); StateVariable stateVariable = getService().getStateVariable(variableName); if (stateVariable == null || !stateVariable.getEventDetails().isSendEvents()) { log.fine("Ignoring unknown or non-evented state variable: " + variableName); continue; } StateVariableAccessor accessor = getService().getAccessor(stateVariable); if (accessor == null) { log.warning("Ignoring evented state variable without accessor: " + variableName); continue; } values.add(accessor.read(stateVariable, getImplementation())); } return values; } finally { unlock(); } }
@Override public Collection<StateVariableValue> getCurrentState() throws Exception { lock(); try { Collection<StateVariableValue> values = readInitialEventedStateVariableValues(); if (values != null) { log.fine("Obtained initial state variable values for event, skipping individual state variable accessors"); return values; } values = new ArrayList(); for (StateVariable stateVariable : getService().getStateVariables()) { if (stateVariable.getEventDetails().isSendEvents()) { StateVariableAccessor accessor = getService().getAccessor(stateVariable); if (accessor == null) throw new IllegalStateException("No accessor for evented state variable"); values.add(accessor.read(stateVariable, getImplementation())); } } return values; } finally { unlock(); } }
protected T createServiceInstance() throws Exception { if (serviceClass == null) { throw new IllegalStateException("Subclass has to provide service class or override createServiceInstance()"); } try { // Use this constructor if possible return serviceClass.getConstructor(LocalService.class).newInstance(getService()); } catch (NoSuchMethodException ex) { log.fine("Creating new service implementation instance with no-arg constructor: " + serviceClass.getName()); return serviceClass.newInstance(); } }
protected Collection<StateVariableValue> getCurrentState(String[] variableNames) throws Exception { lock(); try { Collection<StateVariableValue> values = new ArrayList<>(); for (String variableName : variableNames) { variableName = variableName.trim(); StateVariable stateVariable = getService().getStateVariable(variableName); if (stateVariable == null || !stateVariable.getEventDetails().isSendEvents()) { log.fine("Ignoring unknown or non-evented state variable: " + variableName); continue; } StateVariableAccessor accessor = getService().getAccessor(stateVariable); if (accessor == null) { log.warning("Ignoring evented state variable without accessor: " + variableName); continue; } values.add(accessor.read(stateVariable, getImplementation())); } return values; } finally { unlock(); } }
@Override public Collection<StateVariableValue> getCurrentState() throws Exception { lock(); try { Collection<StateVariableValue> values = readInitialEventedStateVariableValues(); if (values != null) { log.fine("Obtained initial state variable values for event, skipping individual state variable accessors"); return values; } values = new ArrayList<>(); for (StateVariable stateVariable : getService().getStateVariables()) { if (stateVariable.getEventDetails().isSendEvents()) { StateVariableAccessor accessor = getService().getAccessor(stateVariable); if (accessor == null) throw new IllegalStateException("No accessor for evented state variable"); values.add(accessor.read(stateVariable, getImplementation())); } } return values; } finally { unlock(); } }