Search in sources :

Example 1 with IllegalAttributeAccessException

use of org.openmuc.jdlms.IllegalAttributeAccessException in project open-smart-grid-platform by OSGP.

the class DefinableLoadProfile method reinitializeCaptureObjects.

private void reinitializeCaptureObjects(final List<DataObject> captureObjectList) throws IllegalAttributeAccessException {
    final List<CaptureObject> captureObjectInitList = new ArrayList<>();
    for (final DataObject captureObject : captureObjectList) {
        final CaptureObject initCaptureObject;
        try {
            initCaptureObject = CaptureObject.newCaptureObject(captureObject);
        } catch (final RuntimeException e) {
            LOGGER.error("Unable to create capture object from: {}", captureObject, e);
            throw new IllegalAttributeAccessException(AccessResultCode.OTHER_REASON, new IllegalArgumentException("Unable to create capture object from: " + captureObject, e));
        }
        if (!PROCESSORS_BY_CAPTURE_OBJECT.containsKey(initCaptureObject)) {
            LOGGER.error("No data processor configured for {}", initCaptureObject);
            throw new IllegalAttributeAccessException(AccessResultCode.OTHER_REASON, new IllegalArgumentException("No data processor configured for " + initCaptureObject));
        }
        captureObjectInitList.add(initCaptureObject);
    }
    this.captureObjectDefinitionCollection = DefinableLoadProfile.initCaptureObjects(captureObjectInitList);
}
Also used : IllegalAttributeAccessException(org.openmuc.jdlms.IllegalAttributeAccessException) DataObject(org.openmuc.jdlms.datatypes.DataObject) ArrayList(java.util.ArrayList)

Example 2 with IllegalAttributeAccessException

use of org.openmuc.jdlms.IllegalAttributeAccessException in project open-smart-grid-platform by OSGP.

the class Clock method setTime.

public void setTime(final DataObject time) throws IllegalAttributeAccessException {
    try {
        final CosemDateTime dateTime = CosemDateTime.decode(time.getValue());
        this.setInternalUtcDateTime(this.fromCosemDateTime(dateTime));
    } catch (final Exception e) {
        LOGGER.error("An error occured while setting the time attribute of CurrentClock.", e);
        throw new IllegalAttributeAccessException(AccessResultCode.OTHER_REASON);
    }
}
Also used : IllegalAttributeAccessException(org.openmuc.jdlms.IllegalAttributeAccessException) CosemDateTime(org.openmuc.jdlms.datatypes.CosemDateTime) IllegalAttributeAccessException(org.openmuc.jdlms.IllegalAttributeAccessException)

Aggregations

IllegalAttributeAccessException (org.openmuc.jdlms.IllegalAttributeAccessException)2 ArrayList (java.util.ArrayList)1 CosemDateTime (org.openmuc.jdlms.datatypes.CosemDateTime)1 DataObject (org.openmuc.jdlms.datatypes.DataObject)1