Пример #1
0
  /**
   * Creates a <code>MessageDestination</code> instance, sets its id, sets it manageable if the
   * <code>AbstractService</code> that created it is manageable, and sets its <code>Service</code>
   * to the <code>AbstractService</code> that created it.
   *
   * @param id The id of the <code>MessageDestination</code>.
   * @return The <code>Destination</code> instanced created.
   */
  @Override
  public Destination createDestination(String id) {
    if (id == null) {
      // Cannot add ''{0}'' with null id to the ''{1}''
      ConfigurationException ex = new ConfigurationException();
      ex.setMessage(
          ConfigurationConstants.NULL_COMPONENT_ID, new Object[] {"Destination", "Service"});
      throw ex;
    }

    // check with the message broker to make sure that no destination with the id already exists
    getMessageBroker().isDestinationRegistered(id, getId(), true);

    MessageDestination destination = new MessageDestination();
    destination.setId(id);
    destination.setManaged(isManaged());
    destination.setService(this);

    return destination;
  }