Beispiel #1
0
  public Topic[] participantFindTopic(Participant participant, String topicName)
      throws CommunicationException {
    Topic[] result = null;
    this.checkConnection();

    try {
      String xmlEntity = entitySerializer.serializeEntity(participant);
      String xmlEntities = this.jniParticipantFindTopic(xmlEntity, topicName);
      this.checkConnection();
      Entity[] entityResult = entityDeserializer.deserializeEntityList(xmlEntities);

      if (entityResult != null) {
        result = new Topic[entityResult.length];

        for (int i = 0; i < entityResult.length; i++) {
          result[i] = (Topic) (entityResult[i]);
        }
      } else {
        throw new CommunicationException("Could not find topic.");
      }
    } catch (TransformationException e) {
      throw new CommunicationException("Could not find topic.");
    }
    return result;
  }
Beispiel #2
0
  public Entity[] waitsetTimedWait(Waitset waitset, Time time) throws CommunicationException {
    Entity[] result = null;
    this.checkConnection();

    try {
      String xmlWaitset = entitySerializer.serializeEntity(waitset);
      String xmlEntities = this.jniWaitsetTimedWait(xmlWaitset, time.sec, time.nsec);
      this.checkConnection();

      Entity[] entityResult = entityDeserializer.deserializeEntityList(xmlEntities);

      if (entityResult != null) {
        result = new Entity[entityResult.length];

        for (int i = 0; i < entityResult.length; i++) {
          result[i] = entityResult[i];
        }
      } else {
        throw new CommunicationException("waitsetTimedWait failed (2)");
      }
    } catch (TransformationException e) {
      throw new CommunicationException("waitsetTimedWait failed");
    }
    return result;
  }
Beispiel #3
0
  public Partition partitionNew(Participant p, String name) throws CommunicationException {
    Partition dom;
    this.checkConnection();

    try {
      String xmlEntity = entitySerializer.serializeEntity(p);
      String xmlDom = this.jniDomainNew(xmlEntity, name);
      this.checkConnection();
      dom = (Partition) (entityDeserializer.deserializeEntity(xmlDom));
    } catch (TransformationException e) {
      throw new CommunicationException("Could not create partition.");
    }
    return dom;
  }
Beispiel #4
0
  public ServiceState serviceGetState(Service service) throws CommunicationException {
    ServiceState state;
    this.checkConnection();

    try {
      String xmlEntity = entitySerializer.serializeEntity(service);
      String xmlState = this.jniGetServiceState(xmlEntity);
      this.checkConnection();
      state = (ServiceState) (entityDeserializer.deserializeEntity(xmlState));
    } catch (TransformationException e) {
      throw new CommunicationException("Could not resolve service state.");
    }
    return state;
  }
Beispiel #5
0
  public Waitset waitsetNew(Participant participant) throws CommunicationException {
    Waitset waitset = null;

    this.checkConnection();

    try {
      String xmlEntity = entitySerializer.serializeEntity(participant);
      String xmlWaitset = this.jniWaitsetNew(xmlEntity);
      this.checkConnection();
      waitset = (Waitset) (entityDeserializer.deserializeEntity(xmlWaitset));
    } catch (TransformationException e) {
      throw new CommunicationException("Could not create waitset.");
    }
    return waitset;
  }
Beispiel #6
0
  public Query queryNew(Reader source, String name, String expression)
      throws CommunicationException {
    Query q;
    this.checkConnection();

    try {
      String xmlRea = entitySerializer.serializeEntity(source);
      String xmlResult = this.jniQueryNew(xmlRea, name, expression);
      this.checkConnection();
      q = (Query) (entityDeserializer.deserializeEntity(xmlResult));
    } catch (TransformationException e) {
      throw new CommunicationException("Could not create query.");
    }
    return q;
  }
Beispiel #7
0
  public Entity[] entityDependantEntities(Entity entity, EntityFilter filter)
      throws CommunicationException {
    Entity[] result = null;
    this.checkConnection();

    try {
      String xmlEntity = entitySerializer.serializeEntity(entity);
      String xmlEntities = this.jniGetDependantEntities(xmlEntity, EntityFilter.getString(filter));
      this.checkConnection();
      result = entityDeserializer.deserializeEntityList(xmlEntities);
    } catch (TransformationException e) {
      throw new CommunicationException("Could not resolve dependant entities.");
    }
    return result;
  }
Beispiel #8
0
  public Participant participantNew(String uri, int timeout, String name, ParticipantQoS qos)
      throws CommunicationException {
    Participant participant;
    String xmlQos = null;
    this.checkConnection();

    try {
      if (qos != null) {
        xmlQos = qosSerializer.serializeQoS(qos);
      }
      String xmlEntity = this.jniCreateParticipant(uri, timeout, name, xmlQos);
      this.checkConnection();
      participant = (Participant) (entityDeserializer.deserializeEntity(xmlEntity));
    } catch (TransformationException e) {
      throw new CommunicationException("Could not create participant");
    }
    return participant;
  }
Beispiel #9
0
  public Topic topicNew(Participant p, String name, String typeName, String keyList, TopicQoS qos)
      throws CommunicationException {
    Topic top;
    String xmlQos = null;
    this.checkConnection();

    try {
      if (qos != null) {
        xmlQos = qosSerializer.serializeQoS(qos);
      }
      String xmlEntity = entitySerializer.serializeEntity(p);
      String xmlTop = this.jniTopicNew(xmlEntity, name, typeName, keyList, xmlQos);
      this.checkConnection();
      top = (Topic) (entityDeserializer.deserializeEntity(xmlTop));
    } catch (TransformationException e) {
      throw new CommunicationException("Could not create topic.");
    }
    return top;
  }
Beispiel #10
0
  public DataReader dataReaderNew(Subscriber s, String name, String viewExpression, ReaderQoS qos)
      throws CommunicationException {
    DataReader dr;
    String xmlQos = null;
    this.checkConnection();

    try {
      if (qos != null) {
        xmlQos = qosSerializer.serializeQoS(qos);
      }
      String xmlSub = entitySerializer.serializeEntity(s);
      String xmlResult = this.jniCreateDataReader(xmlSub, name, viewExpression, xmlQos);
      this.checkConnection();
      dr = (DataReader) (entityDeserializer.deserializeEntity(xmlResult));
    } catch (TransformationException e) {
      throw new CommunicationException("Could not create datareader.");
    }
    return dr;
  }
Beispiel #11
0
  public Subscriber subscriberNew(Participant p, String name, SubscriberQoS qos)
      throws CommunicationException {
    Subscriber sub;
    String xmlQos = null;
    this.checkConnection();

    try {
      if (qos != null) {
        xmlQos = qosSerializer.serializeQoS(qos);
      }
      String xmlEntity = entitySerializer.serializeEntity(p);
      String xmlSub = this.jniSubscriberNew(xmlEntity, name, xmlQos);
      this.checkConnection();
      sub = (Subscriber) (entityDeserializer.deserializeEntity(xmlSub));
    } catch (TransformationException e) {
      throw new CommunicationException("Could not create subscriber.");
    }
    return sub;
  }
Beispiel #12
0
  public Writer writerNew(Publisher p, String name, Topic t, WriterQoS qos)
      throws CommunicationException {
    Writer wri;
    String xmlQos = null;
    this.checkConnection();

    try {
      if (qos != null) {
        xmlQos = qosSerializer.serializeQoS(qos);
      }
      String xmlEntity = entitySerializer.serializeEntity(p);
      String xmlTopic = entitySerializer.serializeEntity(t);
      String xmlResult = this.jniCreateWriter(xmlEntity, name, xmlTopic, xmlQos);
      this.checkConnection();
      wri = (Writer) (entityDeserializer.deserializeEntity(xmlResult));
    } catch (TransformationException e) {
      throw new CommunicationException("Could not create writer.");
    }
    return wri;
  }
Beispiel #13
0
  public Partition[] participantAllDomains(Participant p) throws CommunicationException {
    Partition[] result = null;
    this.checkConnection();

    try {
      String xmlEntity = entitySerializer.serializeEntity(p);
      String xmlEntities = this.jniParticipantAllDomains(xmlEntity);
      this.checkConnection();
      Entity[] entityResult = entityDeserializer.deserializeEntityList(xmlEntities);

      if (entityResult != null) {
        result = new Partition[entityResult.length];

        for (int i = 0; i < entityResult.length; i++) {
          result[i] = (Partition) (entityResult[i]);
        }
      } else {
        throw new CommunicationException("Could not resolve all partitions");
      }
    } catch (TransformationException e) {
      throw new CommunicationException("Could not resolve all partitions");
    }
    return result;
  }