/** * Sets the default adapter of the <code>AbstractService</code>. * * @param id The id of the default adapter. */ public void setDefaultAdapter(String id) { if (adapterClasses.get(id) == null) { // No adapter with id '{0}' is registered with the service '{1}'. ConfigurationException ex = new ConfigurationException(); ex.setMessage(ConfigurationConstants.UNREGISTERED_ADAPTER, new Object[]{id, getId()}); throw ex; } defaultAdapterId = id; }
/** * Sets the default adapter of the <code>AbstractService</code>. * * @param id The id of the default adapter. */ public void setDefaultAdapter(String id) { if (adapterClasses.get(id) == null) { // No adapter with id '{0}' is registered with the service '{1}'. ConfigurationException ex = new ConfigurationException(); ex.setMessage(ConfigurationConstants.UNREGISTERED_ADAPTER, new Object[]{id, getId()}); throw ex; } defaultAdapterId = id; }
/** * Sets the default adapter of the <code>AbstractService</code>. * * @param id The id of the default adapter. */ public void setDefaultAdapter(String id) { if (adapterClasses.get(id) == null) { // No adapter with id '{0}' is registered with the service '{1}'. ConfigurationException ex = new ConfigurationException(); ex.setMessage(ConfigurationConstants.UNREGISTERED_ADAPTER, new Object[]{id, getId()}); throw ex; } defaultAdapterId = id; }
/** * Sets the <code>MessageBroker</code> of the <code>AbstractService</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>AbstractService</code>. */ public void setMessageBroker(MessageBroker broker) { MessageBroker oldBroker = getMessageBroker(); setParent(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> of the <code>AbstractService</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>AbstractService</code>. */ public void setMessageBroker(MessageBroker broker) { MessageBroker oldBroker = getMessageBroker(); setParent(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> of the <code>AbstractService</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>AbstractService</code>. */ public void setMessageBroker(MessageBroker broker) { MessageBroker oldBroker = getMessageBroker(); setParent(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>AbstractService</code>. If the <code>AbstractService</code> * has a <code>MessageBroker</code> assigned, it also updates the id in the * <code>MessageBroker</code>. * * @param id the id */ @Override public void setId(String id) { String oldId = getId(); super.setId(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>AbstractService</code>. If the <code>AbstractService</code> * has a <code>MessageBroker</code> assigned, it also updates the id in the * <code>MessageBroker</code>. */ public void setId(String id) { String oldId = getId(); super.setId(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); } }
/** * Verifies that the <code>AbstractService</code> is in valid state before * it is started. If subclasses override, they must call <code>super.validate()</code>. */ protected void validate() { if (isValid()) return; super.validate(); if (defaultChannels != null) { for (Iterator iter = defaultChannels.iterator(); iter.hasNext();) { String id = (String) iter.next(); if (!getMessageBroker().getChannelIds().contains(id)) { iter.remove(); if (Log.isWarn()) { Log.getLogger(getLogCategory()).warn("Removing the Channel "+id+" from Destination "+getId()+ "as MessageBroker does not know the channel"); } } } } else { defaultChannels = getMessageBroker().getDefaultChannels(); } }
/** * Sets the id of the <code>AbstractService</code>. If the <code>AbstractService</code> * has a <code>MessageBroker</code> assigned, it also updates the id in the * <code>MessageBroker</code>. * * @param id the id */ @Override public void setId(String id) { String oldId = getId(); super.setId(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); } }
if (Log.isWarn()) Log.getLogger(getLogCategory()).warn("Removing the Channel "+id+" from Destination "+getId()+ "as MessageBroker does not know the channel");
if (Log.isWarn()) Log.getLogger(getLogCategory()).warn("Removing the Channel "+id+" from Destination "+getId()+ "as MessageBroker does not know the channel");
/** * Creates a <code>Destination</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. Note that it cannot have a null id and cannot have an id of * a <code>Destination</code> already registered with the <code>AbstractService</code>. * * @param id The id of the <code>Destination</code>. * @return The <code>Destination</code> instanced created. */ 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); Destination destination = new Destination(); destination.setId(id); destination.setManaged(isManaged()); destination.setService(this); return destination; }
getMessageBroker().registerDestination(id, getId());
getMessageBroker().registerDestination(id, getId());
/** * Creates a <code>Destination</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. Note that it cannot have a null id and cannot have an id of * a <code>Destination</code> already registered with the <code>AbstractService</code>. * * @param id The id of the <code>Destination</code>. * @return The <code>Destination</code> instanced created. */ 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); Destination destination = new Destination(); destination.setId(id); destination.setManaged(isManaged()); destination.setService(this); return destination; }
getMessageBroker().registerDestination(id, getId());
new Object[]{getId()});
new Object[]{getId()});
new Object[]{getId()});