/**
  * Sendet Daten an das Objekt
  *
  * @param senderObject Sender-Objekt
  * @param data Daten
  * @param dataTime Zeit des Datensatzes
  */
 public void sendData(final KExDaVSender senderObject, final Data data, final long dataTime) {
   final SystemObject systemObject = getWrappedObject();
   if (systemObject == null) return;
   try {
     final InnerSender sender = _senders.get(senderObject);
     if (sender == null) throw new IllegalStateException("Sender wurde noch nicht angemeldet");
     sender.sendData(systemObject, data, dataTime);
   } catch (SendSubscriptionNotConfirmed sendSubscriptionNotConfirmed) {
     _manager.addMessage(
         Message.newMajor("Kann derzeit nicht senden", sendSubscriptionNotConfirmed));
   }
 }
    public void sendData(final SystemObject systemObject, Data data, final long dataTime)
        throws SendSubscriptionNotConfirmed {
      final ResultData resultData;
      if (data != null) {
        if (!(data instanceof KExDaVAttributeGroupData)) {
          data = new KExDaVAttributeGroupData(data, _manager);
        }
        resultData =
            ((KExDaVAttributeGroupData) data)
                .toResultData(systemObject, _dataDescription, dataTime);
      } else {
        resultData = new ResultData(systemObject, _dataDescription, dataTime, null);
      }

      try {

        if (_hasPendingSourceSubscription) {
          try {
            _connection.subscribeSource(this, resultData);
            _hasPendingSourceSubscription = false;
          } catch (OneSubscriptionPerSendData ignored) {
            _connection.sendData(resultData);
          }
        } else if (_state == ClientSenderInterface.START_SENDING
            || (_state == ClientSenderInterface.STOP_SENDING
                && _senderRole == SenderRole.source())) {
          _connection.sendData(resultData);
        } else {
          _lastData = resultData;
        }
      } catch (DataNotSubscribedException ignored) {
        _lastData = resultData;
      }

      if (_state == ClientSenderInterface.STOP_SENDING_NO_RIGHTS) {
        _manager.addMessage(Message.newMajor("Keine Rechte zum Senden von Daten: " + this));
      } else if (_state == ClientSenderInterface.STOP_SENDING_NOT_A_VALID_SUBSCRIPTION) {
        _manager.addMessage(Message.newMajor("Ungültige Anmeldung des Empfängers: " + this));
      }
    }
 private void registerSender(final InnerSender innerSender, final SystemObject systemObject) {
   try {
     if (innerSender.getSenderRole() != SenderRole.source()) {
       // Quellen werden verzögert beim ersten Datensatz angemeldet
       _connection.subscribeSender(
           innerSender,
           systemObject,
           innerSender.getDataDescription(),
           innerSender.getSenderRole());
     }
   } catch (OneSubscriptionPerSendData oneSubscriptionPerSendData) {
     _manager.addMessage(
         Message.newMajor("Kann nicht als Sender anmelden", oneSubscriptionPerSendData));
   }
 }
 public void dataRequest(
     final SystemObject object, final DataDescription dataDescription, final byte state) {
   if (state == _state) return;
   _state = state;
   _senderObject.update(state);
   if (_state == ClientSenderInterface.START_SENDING
       && _lastData != null
       && _senderRole != SenderRole.source()) {
     try {
       _connection.sendData(_lastData);
       _lastData = null;
     } catch (SendSubscriptionNotConfirmed sendSubscriptionNotConfirmed) {
       _manager.addMessage(
           Message.newMajor("Kann derzeit nicht senden", sendSubscriptionNotConfirmed));
     }
   }
 }
 @Override
 protected Set<SetExchangeDescription> getExchangeDescriptionsFromNewParameters(
     final RemoteDaVParameter parameters) {
   final Set<SetExchangeDescription> result = new HashSet<SetExchangeDescription>();
   for (final ExchangeSetParameter setParameter : parameters.getExchangeSetParameters()) {
     final SystemObject localObject =
         _correspondingObjectManager
             .getLocalConnection()
             .getDataModel()
             .getObject(setParameter.getLocalObject());
     final SystemObject remoteObject =
         _correspondingObjectManager
             .getRemoteConnection()
             .getDataModel()
             .getObject(setParameter.getRemoteObject());
     if (remoteObject != null
         && localObject != null
         && remoteObject instanceof ConfigurationObject
         && localObject instanceof ConfigurationObject) {
       result.add(
           new SetExchangeDescription(
               (ConfigurationObject) localObject,
               (ConfigurationObject) remoteObject,
               setParameter.getLocalSet(),
               setParameter.getRemoteSet(),
               setParameter.getDirection()));
     } else {
       getManager()
           .addMessage(
               Message.newMajor(
                   "Ein Konfigurationsobjekt für den Mengenaustausch ist ungültig. Betroffener Austausch: "
                       + setParameter.getLocalObject()
                       + " <--> "
                       + setParameter.getRemoteObject()));
     }
   }
   return result;
 }