/** * Invoked automatically to allow the <code>HTTPProxyDestination</code> to setup its corresponding * MBean control. * * @param service The <code>Service</code> that manages this <code>HTTPProxyDestination</code>. */ protected void setupDestinationControl(Service service) { controller = new HTTPProxyDestinationControl(this, service.getControl()); controller.register(); setControl(controller); } }
service.initialize(svcId, svcSettings.getProperties()); service.addDefaultChannel(chanSettings.getId()); service.registerAdapter(as.getId(), as.getClassName()); if (as.isDefault()) service.setDefaultAdapter(as.getId());
/** * Sets the <code>Service</code> managing this <code>Destination</code>. * Removes the <code>Destination</code> from the old service * (if there was one) and adds to the list of destination in the new service. * * @param service The <code>Service</code> managing this <code>Destination</code>. */ public void setService(Service service) { Service oldService = getService(); setParent(service); if (oldService != null) oldService.removeDestination(getId()); // Add the destination to the service if needed if (service.getDestination(getId()) != this) service.addDestination(this); }
/** * Sets the id of the <code>Destination</code>. If the <code>Destination</code> * has a <code>Service</code> assigned, it also updates the id in the * <code>Service</code>. * * @param id The id of the <code>Destination</code>. */ public void setId(String id) { String oldId = getId(); super.setId(id); // Update the destination id in the service and MessageBroker Service service = getService(); if (service != null) { service.getMessageBroker().unregisterDestination(oldId); service.getDestinations().remove(oldId); service.getMessageBroker().registerDestination(id, service.getId()); service.getDestinations().put(id, this); } }
/** * Error checking is done on the started MessageBroker to ensure configuration was successful. * * @see MessageBrokerConfigProcessor#processAfterStartup(MessageBroker) */ public MessageBroker processAfterStartup(MessageBroker broker) { // Eagerly detect possible problems with the Service Service service = broker.getServiceByType(getServiceClassName()); Assert.notNull(service, "The MessageBroker with id '" + broker.getId() + "' does not have a service of type " + getServiceClassName() + " configured."); Assert.isTrue(service.isStarted(), "The Service with id '" + service.getId() + "' of MessageBroker with id '" + broker.getId() + "' was not started as expected."); return broker; }
if (!service.isStarted()) new Object[]{getId(), service.getId()}); if (isManaged() && service.isManaged()) ServiceControl controller = (ServiceControl)service.getControl(); if (getControl() != null) controller.addDestination(getControl().getObjectName());
protected ThrottleManager createThrottleManager() { Service service = getService(); if (service == null || service.getMessageBroker() == null) return new ThrottleManager(); // Return the default. try { Class<? extends ThrottleManager> throttleManagerClass = service.getMessageBroker().getThrottleManagerClass(); Object instance = ClassUtil.createDefaultInstance(throttleManagerClass, null); if (instance instanceof ThrottleManager) return (ThrottleManager)instance; } catch (Throwable t) { // NOWARN } return new ThrottleManager(); // Return the default. }
String id = service.getId(); if (service.getMessageBroker() == null || service.getMessageBroker() != this) service.setMessageBroker(this);
String defaultAdapterId = getService().getDefaultAdapter(); if (defaultAdapterId != null) List brokerChannelIds = getService().getMessageBroker().getChannelIds(); for (Iterator iter = channelIds.iterator(); iter.hasNext();) List defaultChannelIds = getService().getDefaultChannels(); if (defaultChannelIds != null && defaultChannelIds.size() > 0) MessageBroker broker = getService().getMessageBroker();
Destination destination = service.getDestination(destId); inspectOperation(message, destination); "Before invoke service: " + service.getId() + StringUtils.NEWLINE + " incomingMessage: " + message + StringUtils.NEWLINE); serviceResult = service.serviceMessage(message); "After invoke service: " + service.getId() + StringUtils.NEWLINE + " reply: " + debugServiceResult + StringUtils.NEWLINE); "Exception when invoking service '" + (service == null ? "(none)" : service.getId()) + "': "); (service == null ? "(none)" : service.getId()) + StringUtils.NEWLINE + " with message: " + message + StringUtils.NEWLINE + (service == null ? "(none)" : service.getId()) + StringUtils.NEWLINE + " with message: " + message + StringUtils.NEWLINE +
Destination destination = service.getDestination(destId); if (destination != null) inspectOperation(command, destination); commandResult = service.serviceCommand(command); serviced = true; "Executed command: " + (service == null ? "(default service)" : "service=" + service.getId()) + StringUtils.NEWLINE + " commandMessage: " + command + StringUtils.NEWLINE + " replyMessage: " + replyMessage + StringUtils.NEWLINE);
/** * Start all of the broker's services. * * @exclude */ private void startServices() { for (Iterator iter=services.values().iterator(); iter.hasNext(); ) { Service svc = (Service) iter.next(); long timeBeforeStartup = 0; if (Log.isDebug()) { timeBeforeStartup = System.currentTimeMillis(); Log.getLogger(LOG_CATEGORY_STARTUP_SERVICE).debug("Service with id '{0}' is starting.", new Object[]{svc.getId()}); } svc.start(); if (Log.isDebug()) { long timeAfterStartup = System.currentTimeMillis(); Long diffMillis = new Long(timeAfterStartup - timeBeforeStartup); Log.getLogger(LOG_CATEGORY_STARTUP_SERVICE).debug("Service with id '{0}' is ready (startup time: '{1}' ms)", new Object[]{svc.getId(), diffMillis}); } } }
throw ex; Map<String, String> adapterClasses = getService().getRegisteredAdapters(); if (!adapterClasses.containsKey(id)) ex.setMessage(ConfigurationConstants.UNREGISTERED_ADAPTER, new Object[]{id, getService().getId()}); throw ex;
protected void createSpringDestination(Service service, String destinationId) { flex.messaging.services.remoting.RemotingDestination destination = (flex.messaging.services.remoting.RemotingDestination)service.createDestination(destinationId); destination.setSource(destinationId); destination.setFactory(destFactory); if(destAdapter != null) destination.createAdapter(destAdapter); if(destScope != null) destination.setScope(destScope); if(destSecurityConstraint != null) destination.setSecurityConstraint(destSecurityConstraint); if(destChannel != null) destination.addChannel(destChannel); service.addDestination(destination); }
public String getId() { return service.getId(); }
/** * The MessageBroker is checked to see if the Service has already been configured via the BlazeDS XML config. If no * existing Service is found, one will be installed using the defined configuration properties of this class. * * @see MessageBrokerConfigProcessor#processBeforeStartup(MessageBroker) */ public MessageBroker processBeforeStartup(MessageBroker broker) { Service service = broker.getServiceByType(getServiceClassName()); if (service == null) { service = broker.createService(getServiceId(), getServiceClassName()); if (getServiceAdapterId().equals(this.defaultAdapterId)) { service.registerAdapter(getServiceAdapterId(), getServiceAdapterClassName()); } else { Assert.isAssignable(ServiceAdapter.class, this.beanFactory.getType(this.defaultAdapterId), "A custom default adapter id must refer to a valid Spring bean that " + "is a subclass of " + ServiceAdapter.class.getName() + ". "); service.registerAdapter(this.defaultAdapterId, CustomSpringAdapter.class.getName()); } service.setDefaultAdapter(this.defaultAdapterId); if (!ObjectUtils.isEmpty(this.defaultChannels)) { addDefaultChannels(broker, service); } else { findDefaultChannel(broker, service); } } return broker; }
/** * Sets the id of the <code>Destination</code>. If the <code>Destination</code> * has a <code>Service</code> assigned, it also updates the id in the * <code>Service</code>. * * @param id The id of the <code>Destination</code>. */ @Override public void setId(String id) { String oldId = getId(); super.setId(id); // Update the destination id in the service and MessageBroker Service service = getService(); if (service != null) { service.removeDestination(oldId); service.addDestination(this); } }
public Boolean isRunning() { return Boolean.valueOf(service.isStarted()); }
private void createDestination(DestinationSettings destSettings, Service service, ServiceSettings svcSettings) { String destId = destSettings.getId(); Destination destination = service.createDestination(destId); // Channels List chanSettings = destSettings.getChannelSettings(); if (chanSettings.size() > 0) { List<String> channelIds = new ArrayList<String>(2); for (Iterator iter = chanSettings.iterator(); iter.hasNext();) { ChannelSettings cs = (ChannelSettings) iter.next(); channelIds.add(cs.getId()); } destination.setChannels(channelIds); } // Security SecurityConstraint constraint = destSettings.getConstraint(); destination.setSecurityConstraint(constraint); // Initialize with service, adapter and destination properties destination.initialize(destId, svcSettings.getProperties()); destination.initialize(destId, destSettings.getAdapterSettings().getProperties()); destination.initialize(destId, destSettings.getProperties()); // Service Adapter createAdapter(destination, destSettings, svcSettings); }
/** * Try to find a sensible default AMF channel for the default RemotingService * * If a application-level default is set on the MessageBroker, that will be used. Otherwise will use the first * AMFEndpoint from services-config.xml that it finds. * * @param broker * @param service */ @Override public void findDefaultChannel(MessageBroker broker, Service service) { if (!CollectionUtils.isEmpty(broker.getDefaultChannels())) { return; } Iterator<String> channels = broker.getChannelIds().iterator(); while (channels.hasNext()) { Endpoint endpoint = broker.getEndpoint(channels.next()); if (endpoint instanceof AMFEndpoint) { service.addDefaultChannel(endpoint.getId()); return; } } log.warn("No appropriate default channels were detected for the RemotingService. " + "The channels must be explicitly set on any exported service."); }