/** * Sets the <code>MessageBroker</code> managing this <code>AbstractBootstrapService</code>. * Removes the <code>AbstractService</code> from the old broker (if there was one) * and adds to the list of services in the new broker. * * @param broker <code>MessageBroker</code> of the <code>AbstractBootstrapService</code>. */ public void setMessageBroker(MessageBroker broker) { MessageBroker oldBroker = getMessageBroker(); this.broker = broker; if (oldBroker != null) { oldBroker.removeService(getId()); } // Add service to the new broker if needed if (broker.getService(getId()) != this) broker.addService(this); }
/** * Sets the <code>MessageBroker</code> managing this <code>AbstractBootstrapService</code>. * Removes the <code>AbstractService</code> from the old broker (if there was one) * and adds to the list of services in the new broker. * * @param broker <code>MessageBroker</code> of the <code>AbstractBootstrapService</code>. */ public void setMessageBroker(MessageBroker broker) { MessageBroker oldBroker = getMessageBroker(); this.broker = broker; if (oldBroker != null) { oldBroker.removeService(getId()); } // Add service to the new broker if needed if (broker.getService(getId()) != this) broker.addService(this); }
/** * Sets the <code>MessageBroker</code> managing this <code>AbstractBootstrapService</code>. * Removes the <code>AbstractService</code> from the old broker (if there was one) * and adds to the list of services in the new broker. * * @param broker <code>MessageBroker</code> of the <code>AbstractBootstrapService</code>. */ public void setMessageBroker(MessageBroker broker) { MessageBroker oldBroker = getMessageBroker(); this.broker = broker; if (oldBroker != null) { oldBroker.removeService(getId()); } // Add service to the new broker if needed if (broker.getService(getId()) != this) broker.addService(this); }
/** * Sets the id of the <code>AbstractBootstrapService</code>. If the * <code>AbstractBootstrapService</code> has a <code>MessageBroker</code> * already assigned, it also updates the id in the <code>MessageBroker</code>. */ public void setId(String id) { String oldId = getId(); if (id == null) { // Id of a component cannot be null. ConfigurationException ce = new ConfigurationException(); ce.setMessage(NULL_COMPONENT_PROPERTY, new Object[]{"id"}); throw ce; } this.id = id; // Update the service id in the broker MessageBroker broker = getMessageBroker(); if (broker != null) { // broker must have the service then broker.removeService(oldId); broker.addService(this); } }
/** * Sets the id of the <code>AbstractBootstrapService</code>. If the * <code>AbstractBootstrapService</code> has a <code>MessageBroker</code> * already assigned, it also updates the id in the <code>MessageBroker</code>. */ public void setId(String id) { String oldId = getId(); if (id == null) { // Id of a component cannot be null. ConfigurationException ce = new ConfigurationException(); ce.setMessage(NULL_COMPONENT_PROPERTY, new Object[]{"id"}); throw ce; } this.id = id; // Update the service id in the broker MessageBroker broker = getMessageBroker(); if (broker != null) { // broker must have the service then broker.removeService(oldId); broker.addService(this); } }
/** * Sets the id of the <code>AbstractBootstrapService</code>. If the * <code>AbstractBootstrapService</code> has a <code>MessageBroker</code> * already assigned, it also updates the id in the <code>MessageBroker</code>. */ public void setId(String id) { String oldId = getId(); if (id == null) { // Id of a component cannot be null. ConfigurationException ce = new ConfigurationException(); ce.setMessage(NULL_COMPONENT_PROPERTY, new Object[]{"id"}); throw ce; } this.id = id; // Update the service id in the broker MessageBroker broker = getMessageBroker(); if (broker != null) { // broker must have the service then broker.removeService(oldId); broker.addService(this); } }