public void setServer(Server server) { Service[] findServices = server.findServices(); for (Service service : findServices) { Service existingService = getServer().findService(service.getName()); if (existingService != null) { for (Connector connector : service.findConnectors()) { existingService.addConnector(connector); } for (Executor executor : service.findExecutors()) { existingService.addExecutor(executor); } for (LifecycleListener lifecycleListener : service.findLifecycleListeners()) { existingService.addLifecycleListener(lifecycleListener); } existingService.getContainer().setRealm(service.getContainer().getRealm()); existingService .getContainer() .setBackgroundProcessorDelay(service.getContainer().getBackgroundProcessorDelay()); existingService.getContainer().setCluster(service.getContainer().getCluster()); // existingService.getContainer().setResources( // service.getContainer().getResources()); } else { getServer().addService(service); } } this.setHostname(server.getAddress()); this.setPort(server.getPort()); }
/** * Create an <code>ObjectName</code> for this <code>Service</code> object. * * @param domain Domain in which this name is to be created * @param service The Service to be named * @exception MalformedObjectNameException if a name cannot be created */ static ObjectName createObjectName(String domain, Service service) throws MalformedObjectNameException { ObjectName name = null; name = new ObjectName(domain + ":type=Service,serviceName=" + service.getName()); return (name); }